@Test public void expect100Continue() throws InterruptedException, ExecutionException { final Client client = new ApacheClient.Builder().usingExpectContinue(true).build(); final Request request = new HttpRequest.Builder(Method.PUT, this.objectUri, this.operation) .withBody(Bodies.zeroes(2048)).build(); client.execute(request).get(); verify(putRequestedFor(urlEqualTo(this.objectUri.getPath())).withHeader("Expect", equalTo("100-continue"))); }
@Override public ListenableFuture<Response> execute(final Request request) { checkNotNull(request); final BlockingHttpOperation operation = new BlockingHttpOperation(request); final ListenableFuture<Response> baseFuture = this.executorService.submit(operation); return new ForwardingListenableFuture.SimpleForwardingListenableFuture<Response>(baseFuture) { @Override public boolean cancel(final boolean mayInterruptIfRunning) { operation.getApacheRequest().abort(); return delegate().cancel(mayInterruptIfRunning); } }; }
ApacheClient implements Client { @Override public ListenableFuture<Response> execute(final Request request) { checkNotNull(request); final BlockingHttpOperation operation = new BlockingHttpOperation(request); final ListenableFuture<Response> baseFuture = this.executorService.submit(operation); return new ForwardingListenableFuture.SimpleForwardingListenableFuture<Response>(baseFuture) { @Override public boolean cancel(final boolean mayInterruptIfRunning) { operation.getApacheRequest().abort(); return delegate().cancel(mayInterruptIfRunning); } }; } }
ApacheClient implements Client { @Override public ListenableFuture<Response> execute(final Request request) { checkNotNull(request); final BlockingHttpOperation operation = new BlockingHttpOperation(request); final ListenableFuture<Response> baseFuture = this.executorService.submit(operation); return new ForwardingListenableFuture.SimpleForwardingListenableFuture<Response>(baseFuture) { @Override public boolean cancel(final boolean mayInterruptIfRunning) { operation.getApacheRequest().abort(); return delegate().cancel(mayInterruptIfRunning); } }; } private  ApacheClient(final Builder builder); }
ApacheClient implements Client { @Override public ListenableFuture<Response> execute(final Request request) { checkNotNull(request); final BlockingHttpOperation operation = new BlockingHttpOperation(request); final ListenableFuture<Response> baseFuture = this.executorService.submit(operation); return new ForwardingListenableFuture.SimpleForwardingListenableFuture<Response>(baseFuture) { @Override public boolean cancel(final boolean mayInterruptIfRunning) { operation.getApacheRequest().abort(); return delegate().cancel(mayInterruptIfRunning); } }; } private  ApacheClient(final Builder builder); @Override ListenableFuture<Response> execute(final Request request); @Override ListenableFuture<Integer> shutdown(final boolean immediate, final int timeout); @Override String toString(); }
ApacheClient implements Client { @Override public ListenableFuture<Response> execute(final Request request) { checkNotNull(request); final BlockingHttpOperation operation = new BlockingHttpOperation(request); final ListenableFuture<Response> baseFuture = this.executorService.submit(operation); return new ForwardingListenableFuture.SimpleForwardingListenableFuture<Response>(baseFuture) { @Override public boolean cancel(final boolean mayInterruptIfRunning) { operation.getApacheRequest().abort(); return delegate().cancel(mayInterruptIfRunning); } }; } private  ApacheClient(final Builder builder); @Override ListenableFuture<Response> execute(final Request request); @Override ListenableFuture<Integer> shutdown(final boolean immediate, final int timeout); @Override String toString();  }