@Override public State onTrailingHeadersReceived(HttpHeaders headers) throws Exception { fireOnHeaderReceived(headers); return super.onHeadersReceived(headers); }
@Override public ListenableFuture<Response> executeRequest(Request request) { return executeRequest(request, new AsyncCompletionHandlerBase()); }
@Override public State onBodyPartReceived(final HttpResponseBodyPart content) throws Exception { State s = State.CONTINUE; if (accumulateResponseBytes) { s = super.onBodyPartReceived(content); } fireOnBytesReceived(content.getBodyPartBytes()); return s; }
@Override public Response onCompleted(Response response) throws Exception { Response r = super.onCompleted(response); latch.countDown(); return r; }
@Override public State onStatusReceived(HttpResponseStatus status) throws Exception { firedEvents.add(STATUS_RECEIVED_EVENT); return super.onStatusReceived(status); }
@Override public void onThrowable(Throwable t) { try { if (exceptionHandler != null) { exceptionHandler.onThrowable(t); } else { super.onThrowable(t); } } finally { closeConsumer(); } }
@Override public State onContentWriteProgress(long amount, long current, long total) { fireSent(uri, amount, current, total); return super.onContentWriteProgress(amount, current, total); }
@Override public Response onCompleted(Response response) throws Exception { Response r = super.onCompleted(response); notInThreadsLatch.countDown(); return r; }
@Override public State onStatusReceived(HttpResponseStatus status) throws Exception { fireStatus(status); if (isErrorStatus(status)) { switch (errorDocumentBehaviour) { case ACCUMULATE: accumulateBody = true; break; case OMIT: omitBody = true; break; default: break; } } return super.onStatusReceived(status); }
@Override public void onThrowable(Throwable t) { super.onThrowable(t); failedCount.incrementAndGet(); notInThreadsLatch.countDown(); } });
@Override public State onContentWriteProgress(long amount, long current, long total) { fireSent(uri, amount, current, total); return super.onContentWriteProgress(amount, current, total); }
@Override public State onHeadersReceived(final HttpHeaders headers) throws Exception { fireOnHeaderReceived(headers); return super.onHeadersReceived(headers); }
@Override public Response onCompleted(Response response) throws Exception { l.countDown(); return super.onCompleted(response); } }).get(3, TimeUnit.SECONDS);
@Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { if (!status.getUri().toUrl().equals("http://localhost:" + port1 + "/?a=b&c&d=e")) { throw new IOException("failed to parse the query properly"); } return super.onStatusReceived(status); }
public ListenableFuture<Response> execute() { return client.executeRequest(build(), new AsyncCompletionHandlerBase()); } }
@Override public void onThrowable(Throwable t) { super.onThrowable(t); ex.set(t); failedUrl.set(thisUrl); latch.countDown(); } });
/** * {@inheritDoc} */ public State onBodyPartReceived(final HttpResponseBodyPart content) throws Exception { fireReceived(content); if (omitBody) { return State.CONTINUE; } if (!accumulateBody && bodyConsumer != null) { bodyConsumer.consume(content.getBodyByteBuffer()); } else { return super.onBodyPartReceived(content); } return State.CONTINUE; }
@Override public State onHeadersReceived(HttpHeaders headers) throws Exception { firedEvents.add(HEADERS_RECEIVED_EVENT); return super.onHeadersReceived(headers); }
@Override public Response onCompleted(Response response) throws Exception { firedEvents.add(COMPLETED_EVENT); try { return super.onCompleted(response); } finally { completionLatch.countDown(); } }
@Override public State onStatusReceived(final HttpResponseStatus status) throws Exception { if (!status.getUri().toUrl().equals("http://localhost:" + port1 + "/?a=b&c=&d=e")) { throw new IOException("failed to parse the query properly"); } return super.onStatusReceived(status); }