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

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

Introduction

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

Prototype

public final InetSocketAddress getLocalSocketAddress() 

Source Link

Usage

From source file:com.serphacker.serposcope.scraper.http.extensions.CloseableBasicHttpClientConnectionManager.java

@Override
public void connect(final HttpClientConnection conn, final HttpRoute route, final int connectTimeout,
        final HttpContext context) throws IOException {
    Args.notNull(conn, "Connection");
    Args.notNull(route, "HTTP route");
    Asserts.check(conn == this.conn, "Connection not obtained from this manager");
    final HttpHost host;
    if (route.getProxyHost() != null) {
        host = route.getProxyHost();/*w  ww . j  a  v a  2 s. com*/
    } else {
        host = route.getTargetHost();
    }
    final InetSocketAddress localAddress = route.getLocalSocketAddress();
    this.connectionOperator.connect(this.conn, host, localAddress, connectTimeout, this.socketConfig, context);
}

From source file:org.apache.http.impl.conn.BasicHttpClientConnectionManager.java

public void connect(final HttpClientConnection conn, final HttpRoute route, final int connectTimeout,
        final HttpContext context) throws IOException {
    Args.notNull(conn, "Connection");
    Args.notNull(route, "HTTP route");
    Asserts.check(conn == this.conn, "Connection not obtained from this manager");
    final HttpHost host;
    if (route.getProxyHost() != null) {
        host = route.getProxyHost();/*w ww .java2 s. c o  m*/
    } else {
        host = route.getTargetHost();
    }
    final InetSocketAddress localAddress = route.getLocalSocketAddress();
    this.connectionOperator.connect(this.conn, host, localAddress, connectTimeout, this.socketConfig, context);
}

From source file:org.apache.http.impl.conn.PoolingHttpClientConnectionManager.java

public void connect(final HttpClientConnection managedConn, final HttpRoute route, final int connectTimeout,
        final HttpContext context) throws IOException {
    Args.notNull(managedConn, "Managed Connection");
    Args.notNull(route, "HTTP route");
    final ManagedHttpClientConnection conn;
    synchronized (managedConn) {
        final CPoolEntry entry = CPoolProxy.getPoolEntry(managedConn);
        conn = entry.getConnection();//w w w .  j a v  a 2  s .  c o m
    }
    final HttpHost host;
    if (route.getProxyHost() != null) {
        host = route.getProxyHost();
    } else {
        host = route.getTargetHost();
    }
    final InetSocketAddress localAddress = route.getLocalSocketAddress();
    SocketConfig socketConfig = this.configData.getSocketConfig(host);
    if (socketConfig == null) {
        socketConfig = this.configData.getDefaultSocketConfig();
    }
    if (socketConfig == null) {
        socketConfig = SocketConfig.DEFAULT;
    }
    this.connectionOperator.connect(conn, host, localAddress, connectTimeout, socketConfig, context);
}