Package org.apache.commons.httpclient.protocol

Examples of org.apache.commons.httpclient.protocol.Protocol


        // due to how HttpCommons work internally this dance is best to be kept as is
        //

        // NB: not really needed (see below that the protocol is reseted) but in place just in case
        hostConfig = new ProtocolAwareHostConfiguration(hostConfig);
        Protocol directHttp = Protocol.getProtocol(schema);
        Protocol proxiedHttp = new DelegatedProtocol(socketFactory, directHttp, schema, defaultPort);
        // NB: register the new protocol since when using absolute URIs, HttpClient#executeMethod will override the configuration (#387)
        // NB: hence why the original/direct http protocol is saved - as otherwise the connection is not closed since it is considered different
        // NB: (as the protocol identities don't match)

    // this is not really needed since it's being replaced later on
View Full Code Here


        // Append method name
        buf.append(name);
        buf.append(" ");
        // Absolute or relative URL?
        if (!connection.isTransparent()) {
            Protocol protocol = connection.getProtocol();
            buf.append(protocol.getScheme().toLowerCase());
            buf.append("://");
            buf.append(connection.getHost());
            if ((connection.getPort() != -1)
                && (connection.getPort() != protocol.getDefaultPort())
            ) {
                buf.append(":");
                buf.append(connection.getPort());
            }
        }
View Full Code Here

    // ------------------------------------------------- TestCase setup/shutdown

    public void setUp() throws IOException {
        // Configure socket factories
        SimpleSocketFactory serversocketfactory = null;
        Protocol testhttp = null;
        if (this.useSSL) {
            serversocketfactory = new SimpleSSLSocketFactory();
            testhttp = new Protocol("https",
                    (ProtocolSocketFactory)new SimpleSSLTestProtocolSocketFactory(), 443);
        } else {
            serversocketfactory = new SimplePlainSocketFactory();
            testhttp = Protocol.getProtocol("http");
        }
View Full Code Here

        // we must set the host to a secure destination or the CONNECT method
        // will not be used
        client.getHostConfiguration().setHost(
            "notARealHost",
            1234,
            new Protocol(
                "https",
                (ProtocolSocketFactory)new FakeSecureProtocolSocketFactory(),
                443)
        );
       
View Full Code Here

    }

    public void testConnTimeoutRelease() {

        // create a custom protocol that will delay for 500 milliseconds
        Protocol testProtocol = new Protocol(
            "timeout",
            new DelayedProtocolSocketFactory(
                500,
                Protocol.getProtocol("http").getSocketFactory()
            ),
View Full Code Here


    public void testConnTimeout() {

        // create a custom protocol that will delay for 500 milliseconds
        Protocol testProtocol = new Protocol(
            "timeout",
            new DelayedProtocolSocketFactory(
                500,
                Protocol.getProtocol("http").getSocketFactory()
            ),
View Full Code Here

     * Set the given host. Uses the default protocol("http") and its port.
     *
     * @param host The host(IP or DNS name).
     */
    public synchronized void setHost(final String host) {
        Protocol defaultProtocol = Protocol.getProtocol("http");
        setHost(host, defaultProtocol.getDefaultPort(), defaultProtocol);
    }
View Full Code Here

public class LabManagementConnector {
    /**
     * Configures the JVM to bypass HTTPS certificate checks, so that we can talk to HTTPS servers with bogus certificates.
     */
    public static void acceptInvalidCertificates() {
        Protocol acceptAllSsl = new Protocol("https", (ProtocolSocketFactory)new InsecureSSLProtocolSocketFactory(), 443);
        Protocol.registerProtocol("https", acceptAllSsl);
    }
View Full Code Here

    /**
     * Set the given host. Select default protocol and port.
     * @param host The host.
     */
    public synchronized void setHost(String host) {
        Protocol defaultProtocol = Protocol.getProtocol("http");
        setHost(host, null, defaultProtocol.getDefaultPort(), defaultProtocol);
    }
View Full Code Here

        // Append method name
        buf.append(name);
        buf.append(" ");
        // Absolute or relative URL?
        if (!connection.isTransparent()) {
            Protocol protocol = connection.getProtocol();
            buf.append(protocol.getScheme().toLowerCase());
            buf.append("://");
            buf.append(connection.getHost());
            if ((connection.getPort() != -1)
                && (connection.getPort() != protocol.getDefaultPort())
            ) {
                buf.append(":");
                buf.append(connection.getPort());
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.protocol.Protocol

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.