@Test public void testOnHeadersReceivedContentLengthMinus() throws Exception { ResumableAsyncHandler handler = new ResumableAsyncHandler(); HttpHeaders responseHeaders = new DefaultHttpHeaders(); responseHeaders.add(CONTENT_LENGTH, -1); State status = handler.onHeadersReceived(responseHeaders); assertEquals(status, AsyncHandler.State.ABORT, "State should be ABORT for content length -1"); }
@Override public State onHeadersReceived(HttpHeaders headers) throws Exception { responseBuilder.accumulate(headers); String contentLengthHeader = headers.get(CONTENT_LENGTH); if (contentLengthHeader != null) { if (Long.parseLong(contentLengthHeader) == -1L) { return AsyncHandler.State.ABORT; } } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onHeadersReceived(headers); } return State.CONTINUE; }
ResumableAsyncHandler implements AsyncHandler<Response> { @Override public State onHeadersReceived(HttpHeaders headers) throws Exception { responseBuilder.accumulate(headers); String contentLengthHeader = headers.get(CONTENT_LENGTH); if (contentLengthHeader != null) { if (Long.parseLong(contentLengthHeader) == -1L) { return AsyncHandler.State.ABORT; } } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onHeadersReceived(headers); } return State.CONTINUE; } }
ResumableAsyncHandler implements AsyncHandler<Response> { @Override public State onHeadersReceived(HttpHeaders headers) throws Exception { responseBuilder.accumulate(headers); String contentLengthHeader = headers.get(CONTENT_LENGTH); if (contentLengthHeader != null) { if (Long.parseLong(contentLengthHeader) == -1L) { return AsyncHandler.State.ABORT; } } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onHeadersReceived(headers); } return 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 onHeadersReceived(HttpHeaders headers) throws Exception { responseBuilder.accumulate(headers); String contentLengthHeader = headers.get(CONTENT_LENGTH); if (contentLengthHeader != null) { if (Long.parseLong(contentLengthHeader) == -1L) { return AsyncHandler.State.ABORT; } } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onHeadersReceived(headers); } return 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 onHeadersReceived(HttpHeaders headers) throws Exception { responseBuilder.accumulate(headers); String contentLengthHeader = headers.get(CONTENT_LENGTH); if (contentLengthHeader != null) { if (Long.parseLong(contentLengthHeader) == -1L) { return AsyncHandler.State.ABORT; } } if (decoratedAsyncHandler != null) { return decoratedAsyncHandler.onHeadersReceived(headers); } return 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);  }