Ejemplo n.º 1
0
 @Override
 protected URLConnection openConnection(URL url, Proxy proxy) throws IOException {
   URLConnection connection = super.openConnection(url, proxy);
   if (connection instanceof HttpsURLConnection) {
     HttpsURLConnection urlConnection = (HttpsURLConnection) connection;
     HostnameVerifier hostnameVerifier = urlConnection.getHostnameVerifier();
     if (hostnameVerifier != kindHostnameVerifier) {
       urlConnection.setHostnameVerifier(kindHostnameVerifier);
     }
     if (trustedSslSocketFactory != null) {
       urlConnection.setSSLSocketFactory(trustedSslSocketFactory);
     }
   }
   return connection;
 }