Created
December 28, 2018 15:26
-
-
Save ozzi-/b7ed3b5240bc99521facec033a89a637 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SecureHTTPClient { | |
| public static CloseableHttpClient getSecureHTTPClient() { | |
| try { | |
| SSLContext sslContext = SSLContexts.createDefault(); | |
| SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, | |
| new String[]{"TLSv1.2"}, | |
| new String[]{"TLS_DHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"}, | |
| SSLConnectionSocketFactory.getDefaultHostnameVerifier()); | |
| return HttpClients.custom() | |
| .setSSLSocketFactory(sslsf) | |
| .build(); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| System.exit(1); | |
| } | |
| return null; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment