public static void relaxHostChecking(HttpURLConnection conn) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
  if (conn instanceof HttpsURLConnection) {
    HttpsURLConnection httpsConnection=(HttpsURLConnection)conn;
    SSLSocketFactory factory=prepFactory(httpsConnection);
    httpsConnection.setSSLSocketFactory(factory);
    httpsConnection.setHostnameVerifier(TRUSTING_HOSTNAME_VERIFIER);
  }
}

public static void relaxHostChecking ( HttpURLConnection conn ) throws KeyManagementException , NoSuchAlgorithmException , KeyStoreException { if ( conn instanceof HttpsURLConnection ) { HttpsURLConnection httpsConnection = ( HttpsURLConnection ) conn ; SSLSocketFactory factory = prepFactory ( httpsConnection ) ; httpsConnection . setSSLSocketFactory ( factory ) ; httpsConnection . setHostnameVerifier ( TRUSTING_HOSTNAME_VERIFIER ) ; } }
call this with any httpurlconnection , and it will modify the trust settings if it is an https connection .
