Package org.apache.commons.httpclient.protocol

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


    }
   
    private MuleHostConfiguration createHostConfiguration()
    {
        MuleHostConfiguration hostConfig = new MuleHostConfiguration();
        ProtocolSocketFactory socketFactory = new MockSecureProtocolFactory();
        Protocol protocol = new Protocol("http", socketFactory, 80);
        hostConfig.setHost("localhost", 80, protocol);
       
        // since we're using a setHost variant here, too let's assert that it actually worked
        assertMockSocketFactory(hostConfig);
View Full Code Here


       
    }
   
    public void setCertificate(char[] passphrase) throws Exception {

        ProtocolSocketFactory sslFactory = Protocol.getProtocol("https").getSocketFactory();
        SSLConnector ssl = null;
        if (sslFactory instanceof SSLConnector) {
            ssl = (SSLConnector) sslFactory;
            ssl.setClientCert(new File(getClientCertLocation()), passphrase);
        }
View Full Code Here

            ssl.setClientCert(new File(getClientCertLocation()), passphrase);
        }
    }

    public void setEnableCertificate(boolean enabled) {
        ProtocolSocketFactory sslFactory = Protocol.getProtocol("https").getSocketFactory();
        SSLConnector ssl = null;
        if (sslFactory instanceof SSLConnector) {
            ssl = (SSLConnector) sslFactory;
            ssl.setEnableClientCert(enabled);
        }
View Full Code Here

    }

    public void start() throws Exception {
        URI uri = new URI(endpoint.getLocationURI(), false);
        if (uri.getScheme().equals("https")) {
            ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory(
                            endpoint.getSsl(),
                            endpoint.getKeystoreManager());
            Protocol protocol = new Protocol("https", sf, 443);
            HttpHost host = new HttpHost(uri.getHost(), uri.getPort(), protocol);
            this.host = new HostConfiguration();
View Full Code Here

    }
       

   
    public void setEnableCertificate(boolean enabled) {
        ProtocolSocketFactory sslFactory = Protocol.getProtocol("https").getSocketFactory();
       
      SSLConnector ssl = (SSLConnector) sslFactory;
        ssl.setEnableClientCert(enabled);
       
        setUseClientCert(enabled);
View Full Code Here

        setUseClientCert(enabled);
    }
   
    public void setActiveCertificate(){
     
      ProtocolSocketFactory sslFactory = Protocol.getProtocol("https").getSocketFactory();
       
      SSLConnector ssl = (SSLConnector) sslFactory;
        ssl.setActiveCertificate();
     
    }
View Full Code Here

    }
   
   
    public SSLContextManager getSSLContextManager(){
   
      ProtocolSocketFactory sslFactory = Protocol.getProtocol("https").getSocketFactory();
      SSLConnector ssl = (SSLConnector) sslFactory;
       
        return ssl.getSSLContextManager();
  }
View Full Code Here

                usingSecureSocket = isSecure() && !isProxied();

                // use the protocol's socket factory unless this is a secure
                // proxied connection
                final ProtocolSocketFactory socketFactory =
                    (isSecure() && isProxied()
                            ? new DefaultProtocolSocketFactory()
                            : protocolInUse.getSocketFactory());

                if (connectTimeout == 0) {
                    if (localAddress != null) {
                        socket = socketFactory.createSocket(host, port, localAddress, 0);
                    } else {
                        socket = socketFactory.createSocket(host, port);
                    }
                } else {
                    SocketTask task = new SocketTask() {
                        public void doit() throws IOException {
                            if (localAddress != null) {
                                setSocket(socketFactory.createSocket(host, port, localAddress, 0));
                            } else {
                                setSocket(socketFactory.createSocket(host, port));
                            }
                        }
                    };
                    TimeoutController.execute(task, connectTimeout);
                    socket = task.getSocket();
View Full Code Here

        try {
            if (this.socket == null) {
                usingSecureSocket = isSecure() && !isProxied();
                // use the protocol's socket factory unless this is a secure
                // proxied connection
                final ProtocolSocketFactory socketFactory =
                    (isSecure() && isProxied()
                            ? new DefaultProtocolSocketFactory()
                            : protocolInUse.getSocketFactory());
                this.socket = socketFactory.createSocket(
                            host, port,
                            localAddress, 0,
                            this.params);
            }
View Full Code Here

        assertTrue(p2.equals(p1));
    }
   
    public void testProtocolSocketFactory() {
       
        ProtocolSocketFactory p1 = new DefaultProtocolSocketFactory();
        ProtocolSocketFactory p2 = new DefaultProtocolSocketFactory();

        assertTrue(p1.equals(p2));
        assertTrue(p2.equals(p1));

        p1 = new SSLProtocolSocketFactory();
        p2 = new SSLProtocolSocketFactory();

        assertTrue(p1.equals(p2));
        assertTrue(p2.equals(p1));
       
    }
View Full Code Here

TOP

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

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.