Search in sources :

Example 1 with ConnectionShutdownException

use of org.apache.http.impl.conn.ConnectionShutdownException 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 2 with ConnectionShutdownException

use of org.apache.http.impl.conn.ConnectionShutdownException 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 3 with ConnectionShutdownException

use of org.apache.http.impl.conn.ConnectionShutdownException in project jmeter by apache.

the class ManagedClientConnectionImpl method tunnelProxy.

@Override
public void tunnelProxy(final HttpHost next, final boolean secure, final HttpParams params) throws IOException {
    Args.notNull(next, "Next proxy");
    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 not open");
        conn = this.poolEntry.getConnection();
    }
    conn.update(null, next, secure, params);
    synchronized (this) {
        if (this.poolEntry == null) {
            throw new InterruptedIOException();
        }
        final RouteTracker tracker = this.poolEntry.getTracker();
        tracker.tunnelProxy(next, secure);
    }
}
Also used : InterruptedIOException(java.io.InterruptedIOException) ConnectionShutdownException(org.apache.http.impl.conn.ConnectionShutdownException) OperatedClientConnection(org.apache.http.conn.OperatedClientConnection) RouteTracker(org.apache.http.conn.routing.RouteTracker)

Example 4 with ConnectionShutdownException

use of org.apache.http.impl.conn.ConnectionShutdownException in project jmeter by apache.

the class ManagedClientConnectionImpl method layerProtocol.

@Override
public void layerProtocol(final HttpContext context, 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(), "Protocol layering without a tunnel not supported");
        Asserts.check(!tracker.isLayered(), "Multiple protocol layering not supported");
        target = tracker.getTargetHost();
        conn = this.poolEntry.getConnection();
    }
    this.operator.updateSecureConnection(conn, target, context, params);
    synchronized (this) {
        if (this.poolEntry == null) {
            throw new InterruptedIOException();
        }
        final RouteTracker tracker = this.poolEntry.getTracker();
        tracker.layerProtocol(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)

Aggregations

InterruptedIOException (java.io.InterruptedIOException)4 OperatedClientConnection (org.apache.http.conn.OperatedClientConnection)4 RouteTracker (org.apache.http.conn.routing.RouteTracker)4 ConnectionShutdownException (org.apache.http.impl.conn.ConnectionShutdownException)4 HttpHost (org.apache.http.HttpHost)3