Package org.apache.http.nio.conn

Examples of org.apache.http.nio.conn.OperatedClientConnection


    }

    public synchronized void layerProtocol(
            final HttpContext context, final HttpParams params) throws IOException {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        RouteTracker tracker = this.entry.getTracker();
        if (!tracker.isConnected()) {
            throw new IllegalStateException("Connection not open");
        }
        if (!tracker.isTunnelled()) {
            throw new IllegalStateException("Protocol layering without a tunnel not supported");
        }
        if (tracker.isLayered()) {
            throw new IllegalStateException("Multiple protocol layering not supported");
        }
        HttpHost target = tracker.getTargetHost();
        Scheme scheme = this.manager.getSchemeRegistry().getScheme(target);
        LayeringStrategy layeringStrategy = scheme.getLayeringStrategy();
        if (layeringStrategy == null) {
            throw new IllegalStateException(scheme.getName() +
                    " scheme does not provider support for protocol layering");
        }
        IOSession iosession = this.entry.getIOSession();
        SSLIOSession ssliosession = (SSLIOSession) layeringStrategy.layer(iosession);
        ssliosession.bind(SSLMode.CLIENT, params);

        conn.upgrade(ssliosession);
        tracker.layerProtocol(layeringStrategy.isSecure());
    }
View Full Code Here


            throw new ConnectionShutdownException();
        }
    }

    private OperatedClientConnection getWrappedConnection() {
        OperatedClientConnection conn = this.conn;
        if (conn == null) {
            throw new ConnectionShutdownException();
        }
        return conn;
    }
View Full Code Here

        return null;
    }

    public boolean isSecure() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        return conn.getSSLIOSession() != null;
    }
View Full Code Here

        return conn.getSSLIOSession() != null;
    }

    public InetAddress getLocalAddress() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        if (conn instanceof HttpInetConnection) {
            return ((HttpInetConnection) conn).getLocalAddress();
        } else {
            return null;
        }
View Full Code Here

        }
    }

    public int getLocalPort() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        if (conn instanceof HttpInetConnection) {
            return ((HttpInetConnection) conn).getLocalPort();
        } else {
            return -1;
        }
View Full Code Here

        }
    }

    public InetAddress getRemoteAddress() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        if (conn instanceof HttpInetConnection) {
            return ((HttpInetConnection) conn).getRemoteAddress();
        } else {
            return null;
        }
View Full Code Here

        }
    }

    public int getRemotePort() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        if (conn instanceof HttpInetConnection) {
            return ((HttpInetConnection) conn).getRemotePort();
        } else {
            return -1;
        }
View Full Code Here

        }
    }

    public synchronized HttpConnectionMetrics getMetrics() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        return conn.getMetrics();
    }
View Full Code Here

        return conn.getMetrics();
    }

    public synchronized int getSocketTimeout() {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        return conn.getSocketTimeout();
    }
View Full Code Here

        return conn.getSocketTimeout();
    }

    public synchronized void setSocketTimeout(int timeout) {
        assertValid();
        OperatedClientConnection conn = getWrappedConnection();
        conn.setSocketTimeout(timeout);
    }
View Full Code Here

TOP

Related Classes of org.apache.http.nio.conn.OperatedClientConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.