Created
November 20, 2013 22:51
-
-
Save Richie97/7572622 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
OkHttpClient providesOkHttpClient() { | |
OkHttpClient httpClient = new OkHttpClient(); | |
SSLContext sslContext; | |
try { | |
sslContext = SSLContext.getInstance("TLS"); | |
sslContext.init(null, null, null); | |
} catch (GeneralSecurityException e) { | |
throw new AssertionError(); // The system has no TLS. Just give up. | |
} | |
httpClient.setSslSocketFactory(sslContext.getSocketFactory()); | |
URL.setURLStreamHandlerFactory(httpClient); | |
return httpClient; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment