Search in sources :

Example 51 with OperatedClientConnection

use of org.apache.http.conn.OperatedClientConnection in project platform_external_apache-http by android.

the class AbstractClientConnAdapter method getLocalPort.

// non-javadoc, see interface HttpInetConnection
public int getLocalPort() {
    OperatedClientConnection conn = getWrappedConnection();
    assertValid(conn);
    return conn.getLocalPort();
}
Also used : OperatedClientConnection(org.apache.http.conn.OperatedClientConnection)

Example 52 with OperatedClientConnection

use of org.apache.http.conn.OperatedClientConnection in project jmeter by apache.

the class ManagedClientConnectionImpl method open.

@Override
public void open(final HttpRoute route, final HttpContext context, final HttpParams params) throws IOException {
    Args.notNull(route, "Route");
    Args.notNull(params, "HTTP parameters");
    final OperatedClientConnection conn;
    synchronized (this) {
        if (this.poolEntry == null) {
            throw new ConnectionShutdownException();
        }
        final RouteTracker tracker = this.poolEntry.getTracker();
        Asserts.notNull(tracker, "Route tracker");
        Asserts.check(!tracker.isConnected(), "Connection already open");
        conn = this.poolEntry.getConnection();
    }
    final HttpHost proxy = route.getProxyHost();
    this.operator.openConnection(conn, (proxy != null) ? proxy : route.getTargetHost(), route.getLocalAddress(), context, params);
    synchronized (this) {
        if (this.poolEntry == null) {
            throw new InterruptedIOException();
        }
        final RouteTracker tracker = this.poolEntry.getTracker();
        if (proxy == null) {
            tracker.connectTarget(conn.isSecure());
        } else {
            tracker.connectProxy(proxy, conn.isSecure());
        }
    }
}
Also used : InterruptedIOException(java.io.InterruptedIOException) ConnectionShutdownException(org.apache.http.impl.conn.ConnectionShutdownException) HttpHost(org.apache.http.HttpHost) OperatedClientConnection(org.apache.http.conn.OperatedClientConnection) RouteTracker(org.apache.http.conn.routing.RouteTracker)

Example 53 with OperatedClientConnection

use of org.apache.http.conn.OperatedClientConnection in project jmeter by apache.

the class ManagedClientConnectionImpl method tunnelTarget.

@Override
public void tunnelTarget(final boolean secure, final HttpParams params) throws IOException {
    Args.notNull(params, "HTTP parameters");
    final HttpHost target;
    final OperatedClientConnection conn;
    synchronized (this) {
        if (this.poolEntry == null) {
            throw new ConnectionShutdownException();
        }
        final RouteTracker tracker = this.poolEntry.getTracker();
        Asserts.notNull(tracker, "Route tracker");
        Asserts.check(tracker.isConnected(), "Connection not open");
        Asserts.check(!tracker.isTunnelled(), "Connection is already tunnelled");
        target = tracker.getTargetHost();
        conn = this.poolEntry.getConnection();
    }
    conn.update(null, target, secure, params);
    synchronized (this) {
        if (this.poolEntry == null) {
            throw new InterruptedIOException();
        }
        final RouteTracker tracker = this.poolEntry.getTracker();
        tracker.tunnelTarget(secure);
    }
}
Also used : InterruptedIOException(java.io.InterruptedIOException) ConnectionShutdownException(org.apache.http.impl.conn.ConnectionShutdownException) HttpHost(org.apache.http.HttpHost) OperatedClientConnection(org.apache.http.conn.OperatedClientConnection) RouteTracker(org.apache.http.conn.routing.RouteTracker)

Example 54 with OperatedClientConnection

use of org.apache.http.conn.OperatedClientConnection in project jmeter by apache.

the class ManagedClientConnectionImpl method receiveResponseEntity.

@Override
public void receiveResponseEntity(final HttpResponse response) throws HttpException, IOException {
    final OperatedClientConnection conn = ensureConnection();
    conn.receiveResponseEntity(response);
}
Also used : OperatedClientConnection(org.apache.http.conn.OperatedClientConnection)

Example 55 with OperatedClientConnection

use of org.apache.http.conn.OperatedClientConnection in project jmeter by apache.

the class ManagedClientConnectionImpl method close.

@Override
public void close() throws IOException {
    final HttpPoolEntry local = this.poolEntry;
    if (local != null) {
        final OperatedClientConnection conn = local.getConnection();
        local.getTracker().reset();
        conn.close();
    }
}
Also used : OperatedClientConnection(org.apache.http.conn.OperatedClientConnection)

Aggregations

OperatedClientConnection (org.apache.http.conn.OperatedClientConnection)61 InterruptedIOException (java.io.InterruptedIOException)5 IOException (java.io.IOException)4 Socket (java.net.Socket)4 SSLSession (javax.net.ssl.SSLSession)4 SSLSocket (javax.net.ssl.SSLSocket)4 RouteTracker (org.apache.http.conn.routing.RouteTracker)4 ConnectionShutdownException (org.apache.http.impl.conn.ConnectionShutdownException)4 HttpHost (org.apache.http.HttpHost)3