Created
August 8, 2016 02:57
-
-
Save pollux-/2a27fe58a8c8665da2106474f5de856a to your computer and use it in GitHub Desktop.
Attaching TLSSocketFactory to OkHttp
This file contains 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
/** | |
* Enable TLS specific version V.1.2 | |
* Issue Details : https://github.com/square/okhttp/issues/1934 | |
*/ | |
TLSSocketFactory tlsSocketFactory; | |
try { | |
tlsSocketFactory = new TLSSocketFactory(); | |
httpBuilder.sslSocketFactory(tlsSocketFactory, tlsSocketFactory.systemDefaultTrustManager()); | |
} catch (KeyManagementException | NoSuchAlgorithmException e) { | |
Log.d(TAG, "Failed to create Socket connection "); | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment