@Test
public void allInstancesTimeOut() {
loadBalancer.addServiceEndpoint(new ServiceEndpoint(executor, "localhost:20001", "dc1", dependencyHealthCheck));
loadBalancer.addServiceEndpoint(new ServiceEndpoint(executor, "localhost:20002", "dc1", dependencyHealthCheck));
rpcClient = clientFactory.newClient(serviceName, "testing", FrameworkTest.Foobar.class).
withRetries(1).build();
httpClient.makeRequestsTimeout();
int failureCount = 0;
try {
rpcClient.callSynchronous(FrameworkTest.Foobar.newBuilder().build(), new OrangeContext());
} catch (RpcCallException ex) {
failureCount++;
assertThat(ex.getCategory()).isEqualTo(RpcCallException.Category.RequestTimedOut);
}
assertThat(failureCount).isEqualTo(1);
assertThat(httpClient.verifyRequestsProcessed(1, "localhost:20001")).isTrue();
assertThat(httpClient.verifyRequestsProcessed(1, "localhost:20002")).isTrue();
}