@Test
public void testCallMaxRetries() throws Exception {

  MockSleeper sleeper = new MockSleeper();
  ArrayList<Exception> exceptions = new ArrayList<>();
  exceptions.add(new SocketTimeoutException("socket"));
  exceptions.add(new SocketTimeoutException("socket2"));
  exceptions.add(new SocketTimeoutException("socket3"));
  CallableTester<Exception> callTester = new CallableTester<>(exceptions);
  BackOff backoff = new RetryBoundedBackOff(2, new BackOffTester());
  SocketTimeoutException thrown =
      assertThrows(
          SocketTimeoutException.class,
          () ->
              ResilientOperation.retry(
                  callTester, backoff, RetryDeterminer.DEFAULT, Exception.class, sleeper));
  assertThat(thrown).hasMessageThat().contains("socket3");
  assertThat(callTester.timesCalled()).isEqualTo(3);
  verifySleeper(sleeper, 2);
}