Skip to content

Instantly share code, notes, and snippets.

@nontravis
Created February 12, 2018 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nontravis/0a81b34a6f182768d2b9d90e88bf4d29 to your computer and use it in GitHub Desktop.
Save nontravis/0a81b34a6f182768d2b9d90e88bf4d29 to your computer and use it in GitHub Desktop.
client_nougat.java
OkHttpClient.Builder builder = new OkHttpClient.Builder();
// for resolve SSLHandshakeException at Android 7.0 only
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) {
builder.connectionSpecs(Arrays.asList(
ConnectionSpec.MODERN_TLS,
ConnectionSpec.CLEARTEXT,
new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.allEnabledTlsVersions()
.allEnabledCipherSuites()
.build());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment