@Test
void shouldRetryWithReadTimeout() {

    // socket read timeout caught by AsyncTimeout
    var timeout = new SocketTimeoutException("timeout");
    timeout.initCause(new SocketTimeoutException("Read timed out"));
    assertThat(interceptor.shouldRetry(1, "POST", timeout)).isFalse();
    assertThat(interceptor.shouldRetry(2, "PUT", timeout)).isTrue();
    timeout = new SocketTimeoutException("timeout");
    assertThat(interceptor.shouldRetry(1, "POST", timeout)).isFalse();
    assertThat(interceptor.shouldRetry(2, "PUT", timeout)).isTrue();
    // okio AsyncTimeout close socket when timeout
    timeout = new SocketTimeoutException("timeout");
    timeout.initCause(new SocketException("Socket closed"));
    assertThat(interceptor.shouldRetry(1, "POST", timeout)).isFalse();
    assertThat(interceptor.shouldRetry(2, "PUT", timeout)).isTrue();
    // okio AsyncTimout cancels call when if call timout
    var cancelled = new IOException("Canceled");
    assertThat(interceptor.shouldRetry(1, "POST", cancelled)).isFalse();
    assertThat(interceptor.shouldRetry(2, "PUT", cancelled)).isTrue();
}