@Test
public void retriableError() {
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.setResponseException(new RpcCallException(RpcCallException.Category.
InternalServerError, "test1234").withSource("testing567"));
int failureCount = 0;
try {
rpcClient.callSynchronous(FrameworkTest.Foobar.newBuilder().build(), new OrangeContext());
} catch (RpcCallException ex) {
failureCount++;
assertThat(ex.getCategory()).isEqualTo(RpcCallException.Category.InternalServerError);
assertThat(ex.getMessage()).isEqualTo("test1234");
assertThat(ex.getSource()).isEqualTo("testing567");
}
assertThat(failureCount).isEqualTo(1);
assertThat(httpClient.verifyRequestsProcessed(2)).isTrue();
}