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

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

Introduction

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

Prototype

HttpRoute getRoute();

Source Link

Document

Obtains the current route of this connection.

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);
    }//w ww .j a v a2 s.  c om
    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;
    }
}