Package org.apache.http.conn.ssl

Examples of org.apache.http.conn.ssl.SSLSocketFactory


    int socketTimeout = 900000;
    int connectionTimeout = 60000;

    javax.net.ssl.SSLSocketFactory httpsSocketFactory = KeystoreManagerFactory.getTrustingSecureSocketFactory();
    SSLSocketFactory myFactory = new SSLSocketFactory(new InterruptibleSocketFactory(httpsSocketFactory,connectionTimeout),
      new AllowAllHostnameVerifier());
    Scheme myHttpsProtocol = new Scheme("https", 443, myFactory);

    PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager();
    localConnectionManager.setMaxTotal(1);
View Full Code Here


    // Initialize standard solr-j.
    // First, we need an HttpClient where basic auth is properly set up.
    PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager();
    localConnectionManager.setMaxTotal(1);
    SSLSocketFactory myFactory;
    if (keystoreManager != null)
    {
      myFactory = new SSLSocketFactory(keystoreManager.getSecureSocketFactory(),
        new AllowAllHostnameVerifier());
    }
    else
    {
      // Use the "trust everything" one
      myFactory = new SSLSocketFactory(KeystoreManagerFactory.getTrustingSecureSocketFactory(),
        new AllowAllHostnameVerifier());
    }
    Scheme myHttpsProtocol = new Scheme("https", 443, myFactory);
    localConnectionManager.getSchemeRegistry().register(myHttpsProtocol);
    connectionManager = localConnectionManager;
View Full Code Here

            return;
        }

        final TrustStrategy trustStrategy = httpsCertTrustStrategy.getStrategy();
        final X509HostnameVerifier hostnameVerifier = httpsHostnameVerifyStrategy.getVerifier();
        final SSLSocketFactory socketFactory = new SSLSocketFactory(trustStrategy, hostnameVerifier);
        final Scheme sch = new Scheme("https", 443, socketFactory);
        httpclient.getConnectionManager().getSchemeRegistry().register(sch);
    }
View Full Code Here

    else
    {
      sslcontext.init(null, null, null);
    }
   
    SSLSocketFactory sf = new SSLSocketFactory(sslcontext);
   
    Scheme httpScheme = new Scheme("http", PlainSocketFactory.getSocketFactory(), 80);
   
    SSLSocketFactory socketFactory = SSLSocketFactory.getSocketFactory();
   
    socketFactory.setHostnameVerifier(SSLSocketFactory.STRICT_HOSTNAME_VERIFIER);
   
    Scheme httpsScheme = new Scheme("https", sf, 443);
   
    SchemeRegistry schemeRegistry = new SchemeRegistry();
   
View Full Code Here

            jsseSecurityDomain.setClientAlias(alias);
            jsseSecurityDomain.reloadKeyAndTrustStore();
            KeyManager[] keyManagers = jsseSecurityDomain.getKeyManagers();
            TrustManager[] trustManagers = jsseSecurityDomain.getTrustManagers();
            ctx.init(keyManagers, trustManagers, null);
            SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
            ClientConnectionManager ccm = base.getConnectionManager();
            SchemeRegistry sr = ccm.getSchemeRegistry();
            sr.register(new Scheme("https", 8380, ssf));
            return new DefaultHttpClient(ccm, base.getParams());
        } catch (Exception ex) {
View Full Code Here

            trustStore.load(instream, "nopassword".toCharArray());
        } finally {
            instream.close();
        }
       
        SSLSocketFactory socketFactory = new SSLSocketFactory(trustStore);
        Scheme sch = new Scheme("https", socketFactory, 443);
        httpclient.getConnectionManager().getSchemeRegistry().register(sch);

        HttpGet httpget = new HttpGet("https://localhost/");
View Full Code Here

    }
   
    protected void registerPort(boolean secure, X509HostnameVerifier x509HostnameVerifier, int port, SSLContextParameters sslContextParams) throws Exception {
        SchemeRegistry registry = clientConnectionManager.getSchemeRegistry();
        if (secure) {
            SSLSocketFactory socketFactory;
            if (sslContextParams == null) {
                socketFactory = SSLSocketFactory.getSocketFactory();
            } else {
                socketFactory = new SSLSocketFactory(sslContextParams.createSSLContext());
            }
           
            socketFactory.setHostnameVerifier(x509HostnameVerifier);
            // must register both https and https4
            registry.register(new Scheme("https", port, socketFactory));
            LOG.info("Registering SSL scheme https on port " + port);
           
            registry.register(new Scheme("https4", port, socketFactory));
View Full Code Here

                    + " Previous instance hashcode: " + previous + ", New instance hashcode: " + next);
        }

        SchemeRegistry registry = clientConnectionManager.getSchemeRegistry();
        if (secure) {
            SSLSocketFactory socketFactory;
            if (sslContextParams == null) {
                socketFactory = SSLSocketFactory.getSocketFactory();
            } else {
                socketFactory = new SSLSocketFactory(sslContextParams.createSSLContext());
            }

            socketFactory.setHostnameVerifier(x509HostnameVerifier);
            // must register both https and https4
            registry.register(new Scheme("https", port, socketFactory));
            LOG.info("Registering SSL scheme https on port " + port);
           
            registry.register(new Scheme("https4", port, socketFactory));
View Full Code Here

    int socketTimeout = 900000;
    int connectionTimeout = 60000;

    javax.net.ssl.SSLSocketFactory httpsSocketFactory = KeystoreManagerFactory.getTrustingSecureSocketFactory();
    SSLSocketFactory myFactory = new SSLSocketFactory(new InterruptibleSocketFactory(httpsSocketFactory,connectionTimeout),
      new AllowAllHostnameVerifier());
    Scheme myHttpsProtocol = new Scheme("https", 443, myFactory);

    PoolingClientConnectionManager localConnectionManager = new PoolingClientConnectionManager();
    localConnectionManager.setMaxTotal(1);
View Full Code Here

      connectionManager = localConnectionManager;

      if (keystoreData != null)
      {
        keystoreManager = KeystoreManagerFactory.make("",keystoreData);
        SSLSocketFactory myFactory = new SSLSocketFactory(keystoreManager.getSecureSocketFactory(), new BrowserCompatHostnameVerifier());
        Scheme myHttpsProtocol = new Scheme("https", 443, myFactory);
        connectionManager.getSchemeRegistry().register(myHttpsProtocol);
      }

      fileBaseUrl = serverUrl + encodedServerLocation;
View Full Code Here

TOP

Related Classes of org.apache.http.conn.ssl.SSLSocketFactory

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.