@Test void testInputStreamIsNotClosed() throws SecurityException, NoSuchMethodException, IOException { HttpCommand command = createCommand(); HttpResponse response = HttpResponse.builder().statusCode(500).build(); InputStream inputStream = new InputStream() { int count = 2; @Override public void close() { fail("The retry handler should not close the response stream"); } @Override public int read() throws IOException { return count < 0 ? -1 : --count; } @Override public int available() throws IOException { return count < 0 ? 0 : count; } }; response.setPayload(Payloads.newInputStreamPayload(inputStream)); response.getPayload().getContentMetadata().setContentLength(1L); assertEquals(response.getPayload().openStream().available(), 2); assertEquals(response.getPayload().openStream().read(), 1); handler.shouldRetryRequest(command, response); assertEquals(response.getPayload().openStream().available(), 1); assertEquals(response.getPayload().openStream().read(), 0); }
public boolean shouldRetryRequest(HttpCommand command, IOException error) { return ifReplayableBackoffAndReturnTrue(command); }
BackoffLimitedRetryHandler implements HttpRetryHandler, IOExceptionRetryHandler { public boolean shouldRetryRequest(HttpCommand command, IOException error) { return ifReplayableBackoffAndReturnTrue(command); } }
BackoffLimitedRetryHandler implements HttpRetryHandler, IOExceptionRetryHandler { public boolean shouldRetryRequest(HttpCommand command, IOException error) { return ifReplayableBackoffAndReturnTrue(command); }  }
BackoffLimitedRetryHandler implements HttpRetryHandler, IOExceptionRetryHandler { public boolean shouldRetryRequest(HttpCommand command, IOException error) { return ifReplayableBackoffAndReturnTrue(command); }  boolean shouldRetryRequest(HttpCommand command, IOException error); boolean shouldRetryRequest(HttpCommand command, HttpResponse response); void imposeBackoffExponentialDelay(int failureCount, String commandDescription); void imposeBackoffExponentialDelay(long period, int pow, int failureCount, int max, String commandDescription); void imposeBackoffExponentialDelay(long period, long maxPeriod, int pow, int failureCount, int max,
            String commandDescription); }
BackoffLimitedRetryHandler implements HttpRetryHandler, IOExceptionRetryHandler { public boolean shouldRetryRequest(HttpCommand command, IOException error) { return ifReplayableBackoffAndReturnTrue(command); }  boolean shouldRetryRequest(HttpCommand command, IOException error); boolean shouldRetryRequest(HttpCommand command, HttpResponse response); void imposeBackoffExponentialDelay(int failureCount, String commandDescription); void imposeBackoffExponentialDelay(long period, int pow, int failureCount, int max, String commandDescription); void imposeBackoffExponentialDelay(long period, long maxPeriod, int pow, int failureCount, int max,
            String commandDescription); static final BackoffLimitedRetryHandler INSTANCE; }