Example usage for org.apache.http.impl.nio.client DefaultClientExchangeHandlerImpl start

List of usage examples for org.apache.http.impl.nio.client DefaultClientExchangeHandlerImpl start

Introduction

In this page you can find the example usage for org.apache.http.impl.nio.client DefaultClientExchangeHandlerImpl start.

Prototype

public void start() throws HttpException, IOException 

Source Link

Usage

From source file:org.apache.http.impl.nio.client.InternalHttpAsyncClient.java

@Override
public <T> Future<T> execute(final HttpAsyncRequestProducer requestProducer,
        final HttpAsyncResponseConsumer<T> responseConsumer, final HttpContext context,
        final FutureCallback<T> callback) {
    ensureRunning();/*from   ww  w.  j ava 2s.  c  om*/
    final BasicFuture<T> future = new BasicFuture<T>(callback);
    final HttpClientContext localcontext = HttpClientContext
            .adapt(context != null ? context : new BasicHttpContext());
    setupContext(localcontext);

    @SuppressWarnings("resource")
    final DefaultClientExchangeHandlerImpl<T> handler = new DefaultClientExchangeHandlerImpl<T>(this.log,
            requestProducer, responseConsumer, localcontext, future, this.connmgr, this.connReuseStrategy,
            this.keepaliveStrategy, this.exec);
    try {
        handler.start();
    } catch (final Exception ex) {
        handler.failed(ex);
    }
    return future;
}