Skip to content

Instantly share code, notes, and snippets.

@pollux-
Created August 8, 2016 02:57
Show Gist options
  • Save pollux-/2a27fe58a8c8665da2106474f5de856a to your computer and use it in GitHub Desktop.
Save pollux-/2a27fe58a8c8665da2106474f5de856a to your computer and use it in GitHub Desktop.
Attaching TLSSocketFactory to OkHttp
/**
* 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