Skip to content

Commit

Permalink
Merge branch 'master' into pr_update_okhostnameverifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan committed Nov 8, 2017
2 parents 9590d81 + e3348bf commit 9a6d50c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,20 @@ protected void onCreate(Bundle savedInstanceState) {
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setSSLSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname));

// OkHttp 3
// OkHttp 2.x
OkHttpClient client =
new OkHttpClient()
.setSSLSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname));

// OkHttp 3.0.x, 3.1.x and 3.2.x
OkHttpClient client =
new OkHttpClient.Builder()
.sslSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname))

// OkHttp 3.3.x and higher
OkHttpClient client =
new OkHttpClient().newBuilder()
.sslSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname),
.sslSocketFactory(TrustKit.getInstance().getSSLSocketFactory(serverHostname),
TrustKit.getInstance().getTrustManager(serverHostname))
.build();
}
Expand Down

0 comments on commit 9a6d50c

Please sign in to comment.