Example usage for org.apache.http.conn.routing HttpRoute isTunnelled

List of usage examples for org.apache.http.conn.routing HttpRoute isTunnelled

Introduction

In this page you can find the example usage for org.apache.http.conn.routing HttpRoute isTunnelled.

Prototype

public final boolean isTunnelled() 

Source Link

Usage

From source file:org.siddhiesb.transport.passthru.TargetHandler.java

public void connected(NHttpClientConnection conn, Object o) {
    assert o instanceof HostConnections : "Attachment should be a HostConnections";

    //System.out.println("============ TargetHandler :  connected ===============");

    HostConnections pool = (HostConnections) o;
    conn.getContext().setAttribute(PassThroughConstants.CONNECTION_POOL, pool);
    HttpRoute route = pool.getRoute();

    // create the connection information and set it to request ready
    org.siddhiesb.transport.passthru.TargetContext.create(conn,
            org.siddhiesb.transport.passthru.ProtocolState.REQUEST_READY, targetConfiguration);

    // notify the pool about the new connection
    targetConfiguration.getConnections().addConnection(conn);

    // notify about the new connection
    deliveryAgent.connected(pool.getRoute());

    HttpContext context = conn.getContext();
    context.setAttribute(PassThroughConstants.REQ_DEPARTURE_TIME, System.currentTimeMillis());

    if (route.isTunnelled()) {
        // Requires a proxy tunnel
        ProxyTunnelHandler tunnelHandler = new ProxyTunnelHandler(route, connFactory);
        context.setAttribute(PassThroughConstants.TUNNEL_HANDLER, tunnelHandler);
    }/*ww w. j a  va  2  s.c  o m*/
}