@Test
public void participateFailedThenRetry() {

  tccLoadBalanceSender.onConnected();
  await().atMost(2, TimeUnit.SECONDS).until(new Callable<Boolean>() {
    @Override
    public Boolean call() {
      return connected.get(8080).size() == 1 && connected.get(8090).size() == 1;
    }
  });
  assertThat((connected.get(8080).size() == 1 && connected.get(8090).size() == 1), is(true));
  // due to 8090 is slow than 8080, so 8080 will be routed with 2 times.
  tccLoadBalanceSender.participationStart(participationStartedEvent);
  tccLoadBalanceSender.participationStart(participationStartedEvent);
  tccLoadBalanceSender.participationStart(participationStartedEvent);
  assertThat(eventsMap.get(8080).size(), is(2));
  assertThat(eventsMap.get(8090).size(), is(1));
  // when 8080 was shutdown, request will be routed to 8090 automatically.
  servers.get(8080).shutdownNow();
  tccLoadBalanceSender.participationStart(participationStartedEvent);
  assertThat(eventsMap.get(8090).size(), is(2));
  // when 8080 was recovery, it will be routed again.
  startServerOnPort(8080);
  await().atMost(3, TimeUnit.SECONDS).until(new Callable<Boolean>() {
    @Override
    public Boolean call() {
      return connected.get(8080).size() == 3;
    }
  });
  tccLoadBalanceSender.participationStart(participationStartedEvent);
  assertThat(eventsMap.get(8080).size(), is(3));
}