List of usage examples for org.apache.http.client.fluent Executor registerScheme
@Deprecated public static void registerScheme(final org.apache.http.conn.scheme.Scheme scheme)
From source file:org.talend.core.utils.StudioSSLContextProvider.java
public static boolean setSSLSystemProperty(boolean isPreference) { try {/* www . j a va2 s .c o m*/ buildContext(); if (!isPreference && context == null) { return false; } changeProperty(); Executor.unregisterScheme("https"); SSLSocketFactory factory = new SSLSocketFactory(context, SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); Executor.registerScheme(new Scheme("https", 443, factory)); } catch (Exception e) { if (isPreference) { changeProperty(); Executor.unregisterScheme("https"); } ExceptionHandler.process(new Exception("Please check the SSL settings in Preference>Talend>SSL", e)); return false; } return true; }
From source file:net.bluemix.newsaggregator.api.AuthenticationServlet.java
static public void configureSSL() { // note that it's not adviced to use this in a production application // you should overwrite the X509TrustManager to use a cacerts file (list of trusted signers) try {/*ww w .j a v a 2s .c om*/ SSLContext sslContext = SSLContext.getInstance("SSL_TLSv2"); sslContext.init(null, new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }, new SecureRandom()); Executor.unregisterScheme("https"); SSLSocketFactory sslSocketFactory = new SSLSocketFactory(sslContext, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); Executor.registerScheme(new Scheme("https", 443, sslSocketFactory)); HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); } catch (KeyManagementException | NoSuchAlgorithmException e) { e.printStackTrace(); } }