All trusting HostnameVerifier causes SSL errors with HttpURLConnection
I'm using HttpURLConnection to connect to SSL sites. Occasionally these use self signed certificates / otherwise badly behaved SSL so I have a mode where these an be accessed. I'm using the typical code recommended many places online: // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {} public void checkServerTrusted(java.security