Package org.apache.http.conn.ssl

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


        HttpParams httpParams = new BasicHttpParams();

        SchemeRegistry registry = new SchemeRegistry();

        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        SSLSocketFactory sslSocketFactory;
        if (null == sslContext)
        {
          sslSocketFactory = SSLSocketFactory.getSocketFactory();
        }
        else
        {
          sslSocketFactory = new SSLSocketFactory(sslContext);
        }
        if (null != hostnameVerifier)
        {
          sslSocketFactory.setHostnameVerifier(hostnameVerifier);
        }
        registry.register(new Scheme("https", sslSocketFactory, 443));
       
        ClientConnectionManager connManager;
        if (multiThreadedHttpClient)
View Full Code Here


                            Integer.toString(443)
                        }
                    ));

        Scheme sch = new Scheme("https", 443,
            new SSLSocketFactory(
                    sslCtx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER));
        httpClient.getConnectionManager().getSchemeRegistry().register(sch);

        // set proxy from default jre settings
        ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
View Full Code Here

        } catch (final KeyManagementException e) {
            // should not happen
            // e.printStackTrace();
        }

        final SSLSocketFactory sslSF = new SSLSocketFactory(sslContext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
      return sslSF;
    }
View Full Code Here

      sc.init(null, trustAllCerts, new java.security.SecureRandom());
    } catch (KeyManagementException e1) {
      logger.error("KeyManagementException :" + e1.getMessage());
      e1.printStackTrace();
    }
    SchemeSocketFactory sf = (SchemeSocketFactory) new SSLSocketFactory(sc, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
   
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(
             new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
    schemeRegistry.register(
View Full Code Here

        }
        public void checkServerTrusted(X509Certificate[] chain,  String authType) throws CertificateException
        {
        }
      }}, new SecureRandom());
      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
View Full Code Here

        }
        public void checkServerTrusted(X509Certificate[] chain,  String authType) throws CertificateException
        {
        }
      }}, new SecureRandom());
      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
View Full Code Here

        }
        public void checkServerTrusted(X509Certificate[] chain,  String authType) throws CertificateException
        {
        }
      }}, new SecureRandom());
      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
View Full Code Here

        }
        public void checkServerTrusted(X509Certificate[] chain,  String authType) throws CertificateException
        {
        }
      }}, new SecureRandom());
      SSLSocketFactory sf = new SSLSocketFactory(sslContext, new AllowAllHostnameVerifier());
      httpsScheme = new Scheme("https", 443, sf);
    }
    else
      httpsScheme = new Scheme("http", 80, PlainSocketFactory.getSocketFactory());
    SchemeRegistry schemeRegistry = new SchemeRegistry();
View Full Code Here

                SSLContextParameters sslContextParameters = configuration.getSslContextParameters();
                if (sslContextParameters == null) {
                    sslContextParameters = new SSLContextParameters();
                }
                try {
                    final SSLSocketFactory socketFactory = new SSLSocketFactory(
                        sslContextParameters.createSSLContext(),
                        SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
                    schemeRegistry.register(new Scheme("https", socketFactory, 443));
                } catch (GeneralSecurityException e) {
                    throw ObjectHelper.wrapRuntimeCamelException(e);
View Full Code Here

    }

    public static Result create() {
        Logger.info("CREATE");
        HttpClient httpClient = new DefaultHttpClient();
        SSLSocketFactory sf = (SSLSocketFactory)httpClient.getConnectionManager()
                .getSchemeRegistry().getScheme("https").getSocketFactory();
        sf.setHostnameVerifier(new AllowAllHostnameVerifier());

        try {
            Logger.info("Creating comm");
            HttpPost request = new HttpPost(Application.baseRestUrl + "/communities");
            request.setHeader("Accept", "application/json");
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.