Slide 65
Slide 65 text
TrustKit-AndroidΛར༻
TrustKit.initializeWithNetworkSecurityConfiguration(this);
URL url = new URL("https://www.datatheorem.com");
String serverHostname = url.getHost();
// HttpsUrlConnection
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setSSLSocketFactory(
TrustKit.getInstance().getSSLSocketFactory(serverHostname)
);
// OkHttp 3.3.x and higher
OkHttpClient client =
new OkHttpClient().newBuilder()
.sslSocketFactory(
TrustKit.getInstance().getSSLSocketFactory(serverHostname),
TrustKit.getInstance().getTrustManager(serverHostname)
)
.build();
}