import java.util.concurrent.TimeUnit;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
-import javax.net.ssl.SSLSocketFactory;
import okhttp3.Call;
import okhttp3.ConnectionSpec;
import okhttp3.Credentials;
.supportsTlsExtensions(true)
.build();
okHttpClientBuilder.connectionSpecs(asList(tls, ConnectionSpec.CLEARTEXT));
- okHttpClientBuilder.sslSocketFactory(createSslSocketFactory());
return okHttpClientBuilder.build();
}
- private static SSLSocketFactory createSslSocketFactory() {
- try {
- return (SSLSocketFactory) SSLSocketFactory.getDefault();
- } catch (Exception e) {
- throw new IllegalStateException("Fail to init TLS context", e);
- }
- }
-
@Override
public String baseUrl() {
return baseUrl.url().toExternalForm();