Example usage for org.apache.http.nio.conn ManagedClientAsyncConnection open

List of usage examples for org.apache.http.nio.conn ManagedClientAsyncConnection open

Introduction

In this page you can find the example usage for org.apache.http.nio.conn ManagedClientAsyncConnection open.

Prototype

void open(HttpRoute route, HttpContext context, HttpParams params) throws IOException;

Source Link

Usage

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

private synchronized void connectionRequestCompleted(final ManagedClientAsyncConnection conn) {
    if (this.log.isDebugEnabled()) {
        this.log.debug("[exchange: " + this.id + "] Connection allocated: " + conn);
    }// ww w  .j a va 2s  .com
    this.connRequestCallback = null;
    try {
        this.managedConn = conn;
        if (this.closed) {
            conn.releaseConnection();
            return;
        }
        final HttpRoute route = this.mainRequest.getRoute();
        if (!conn.isOpen()) {
            conn.open(route, this.localContext, this.params);
        }
        conn.getContext().setAttribute(HttpAsyncRequestExecutor.HTTP_HANDLER, this);
        conn.requestOutput();
        this.routeEstablished = route.equals(conn.getRoute());
        if (!conn.isOpen()) {
            throw new ConnectionClosedException("Connection closed");
        }
    } catch (final IOException ex) {
        failed(ex);
    } catch (final RuntimeException runex) {
        failed(runex);
        throw runex;
    }
}