Examples of OperatedClientConnection


Examples of org.apache.http.conn.OperatedClientConnection

        return conn.isSecure();
    }

    // non-javadoc, see interface ManagedClientConnection
    public SSLSession getSSLSession() {
        OperatedClientConnection conn = getWrappedConnection();
        assertValid(conn);
        if (!isOpen())
            return null;

        SSLSession result = null;
        Socket    sock    = conn.getSocket();
        if (sock instanceof SSLSocket) {
            result = ((SSLSocket)sock).getSession();
        }
        return result;
    }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

    // non-javadoc, see interface HttpConnection       
    public void close() throws IOException {
        if (poolEntry != null)
            poolEntry.shutdownEntry();

        OperatedClientConnection conn = getWrappedConnection();
        if (conn != null) {
            conn.close();
        }
    }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

    // non-javadoc, see interface HttpConnection       
    public void shutdown() throws IOException {
        if (poolEntry != null)
            poolEntry.shutdownEntry();

        OperatedClientConnection conn = getWrappedConnection();
        if (conn != null) {
            conn.shutdown();
        }
    }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

        setup(); // some general setup

        // one operator can be used for many connections
        ClientConnectionOperator scop = createOperator();
        OperatedClientConnection conn = scop.createConnection();

        HttpRequest req = createRequest(target);
        HttpContext ctx = createContext();

        System.out.println("opening connection to " + target);
        scop.openConnection(conn, target, null, ctx, getParams());

        System.out.println("sending request");
        conn.sendRequestHeader(req);
        // there is no request entity
        conn.flush();

        System.out.println("receiving response header");
        HttpResponse rsp = conn.receiveResponseHeader();

        System.out.println("----------------------------------------");
        System.out.println(rsp.getStatusLine());
        Header[] headers = rsp.getAllHeaders();
        for (int i=0; i<headers.length; i++) {
            System.out.println(headers[i]);
        }
        System.out.println("----------------------------------------");

        System.out.println("closing connection");
        conn.close();

    } // main
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

        setup(); // some general setup

        // one operator can be used for many connections
        ClientConnectionOperator scop = createOperator();
        OperatedClientConnection conn = scop.createConnection();

        HttpRequest req = createRequest(target);
        HttpContext ctx = createContext();

        System.out.println("opening connection to " + proxy);
        scop.openConnection(conn, proxy, null, ctx, getParams());

        HttpRequest connect = createConnect(target);
        System.out.println("opening tunnel to " + target);
        conn.sendRequestHeader(connect);
        // there is no request entity
        conn.flush();

        System.out.println("receiving confirmation for tunnel");
        HttpResponse connected = conn.receiveResponseHeader();
        System.out.println("----------------------------------------");
        printResponseHeader(connected);
        System.out.println("----------------------------------------");
        int status = connected.getStatusLine().getStatusCode();
        if ((status < 200) || (status > 299)) {
            System.out.println("unexpected status code " + status);
            System.exit(1);
        }
        System.out.println("receiving response body (ignored)");
        conn.receiveResponseEntity(connected);

        // Now we have a tunnel to the target. As we will be creating a
        // layered TLS/SSL socket immediately afterwards, updating the
        // connection with the new target is optional - but good style.
        // The scheme part of the target is already "https", though the
        // connection is not yet switched to the TLS/SSL protocol.
        conn.update(null, target, false, getParams());

        System.out.println("layering secure connection");
        scop.updateSecureConnection(conn, target, ctx, getParams());

        // finally we have the secure connection and can send the request

        System.out.println("sending request");
        conn.sendRequestHeader(req);
        // there is no request entity
        conn.flush();

        System.out.println("receiving response header");
        HttpResponse rsp = conn.receiveResponseHeader();

        System.out.println("----------------------------------------");
        printResponseHeader(rsp);
        System.out.println("----------------------------------------");

        System.out.println("closing connection");
        conn.close();

    } // main
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

            }
        }
        if (!freeEntries.isEmpty()) {
            BasicPoolEntry entry = freeEntries.remove();  
            entry.setState(null);
            OperatedClientConnection conn = entry.getConnection();
            try {
                conn.close();
            } catch (IOException ex) {
                log.debug("I/O error closing connection", ex);
            }
            return entry;
        }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

        }
    }

    // non-javadoc, see interface HttpConnection
    public boolean isOpen() {
        OperatedClientConnection conn = getWrappedConnection();
        if (conn == null)
            return false;

        return conn.isOpen();
    }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

    // non-javadoc, see interface HttpConnection
    public boolean isStale() {
        if (aborted)
            return true;
        OperatedClientConnection conn = getWrappedConnection();
        if (conn == null)
            return true;

        return conn.isStale();
    }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

    }


    // non-javadoc, see interface HttpConnection
    public void setSocketTimeout(int timeout) {
        OperatedClientConnection conn = getWrappedConnection();
        assertValid(conn);
        conn.setSocketTimeout(timeout);
    }
View Full Code Here

Examples of org.apache.http.conn.OperatedClientConnection

    }


    // non-javadoc, see interface HttpConnection
    public int getSocketTimeout() {
        OperatedClientConnection conn = getWrappedConnection();
        assertValid(conn);
        return conn.getSocketTimeout();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.