question: 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 ) ; } }
target:  Call this with any HttpURLConnection, and it will modify the trust settings if it is an HTTPS connection.