@Test public void testOnStatusReceivedOkStatus() throws Exception { MapResumableProcessor processor = new MapResumableProcessor(); ResumableAsyncHandler handler = new ResumableAsyncHandler(processor); HttpResponseStatus responseStatus200 = mock(HttpResponseStatus.class); when(responseStatus200.getStatusCode()).thenReturn(200); when(responseStatus200.getUri()).thenReturn(mock(Uri.class)); State state = handler.onStatusReceived(responseStatus200); assertEquals(state, AsyncHandler.State.CONTINUE, "Status should be CONTINUE for a OK response"); }
@Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { responseBuilder.accumulate(status); if (status.getStatusCode() == 200 || status.getStatusCode() == 206) { url = status.getUri().toUrl(); } else { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onStatusReceived(status); } return AsyncHandler.State.CONTINUE; }
ResumableAsyncHandler implements AsyncHandler<Response> { @Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { responseBuilder.accumulate(status); if (status.getStatusCode() == 200 || status.getStatusCode() == 206) { url = status.getUri().toUrl(); } else { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onStatusReceived(status); } return AsyncHandler.State.CONTINUE; } }
ResumableAsyncHandler implements AsyncHandler<Response> { @Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { responseBuilder.accumulate(status); if (status.getStatusCode() == 200 || status.getStatusCode() == 206) { url = status.getUri().toUrl(); } else { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onStatusReceived(status); } return AsyncHandler.State.CONTINUE; } private  ResumableAsyncHandler(long byteTransferred, ResumableProcessor resumableProcessor,
                                AsyncHandler<Response> decoratedAsyncHandler, boolean accumulateBody);  ResumableAsyncHandler(long byteTransferred);  ResumableAsyncHandler(boolean accumulateBody);  ResumableAsyncHandler();  ResumableAsyncHandler(AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(long byteTransferred, AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(ResumableProcessor resumableProcessor);  ResumableAsyncHandler(ResumableProcessor resumableProcessor, boolean accumulateBody); }
ResumableAsyncHandler implements AsyncHandler<Response> { @Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { responseBuilder.accumulate(status); if (status.getStatusCode() == 200 || status.getStatusCode() == 206) { url = status.getUri().toUrl(); } else { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onStatusReceived(status); } return AsyncHandler.State.CONTINUE; } private  ResumableAsyncHandler(long byteTransferred, ResumableProcessor resumableProcessor,
                                AsyncHandler<Response> decoratedAsyncHandler, boolean accumulateBody);  ResumableAsyncHandler(long byteTransferred);  ResumableAsyncHandler(boolean accumulateBody);  ResumableAsyncHandler();  ResumableAsyncHandler(AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(long byteTransferred, AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(ResumableProcessor resumableProcessor);  ResumableAsyncHandler(ResumableProcessor resumableProcessor, boolean accumulateBody); @Override State onStatusReceived(final HttpResponseStatus status); @Override void onThrowable(Throwable t); @Override State onBodyPartReceived(HttpResponseBodyPart bodyPart); @Override Response onCompleted(); @Override State onHeadersReceived(HttpHeaders headers); @Override State onTrailingHeadersReceived(HttpHeaders headers); Request adjustRequestRange(Request request); ResumableAsyncHandler setResumableListener(ResumableListener resumableListener); }
ResumableAsyncHandler implements AsyncHandler<Response> { @Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { responseBuilder.accumulate(status); if (status.getStatusCode() == 200 || status.getStatusCode() == 206) { url = status.getUri().toUrl(); } else { return AsyncHandler.State.ABORT; } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onStatusReceived(status); } return AsyncHandler.State.CONTINUE; } private  ResumableAsyncHandler(long byteTransferred, ResumableProcessor resumableProcessor,
                                AsyncHandler<Response> decoratedAsyncHandler, boolean accumulateBody);  ResumableAsyncHandler(long byteTransferred);  ResumableAsyncHandler(boolean accumulateBody);  ResumableAsyncHandler();  ResumableAsyncHandler(AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(long byteTransferred, AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(ResumableProcessor resumableProcessor);  ResumableAsyncHandler(ResumableProcessor resumableProcessor, boolean accumulateBody); @Override State onStatusReceived(final HttpResponseStatus status); @Override void onThrowable(Throwable t); @Override State onBodyPartReceived(HttpResponseBodyPart bodyPart); @Override Response onCompleted(); @Override State onHeadersReceived(HttpHeaders headers); @Override State onTrailingHeadersReceived(HttpHeaders headers); Request adjustRequestRange(Request request); ResumableAsyncHandler setResumableListener(ResumableListener resumableListener);  }