Created
August 11, 2011 13:39
-
-
Save ran488/1139678 to your computer and use it in GitHub Desktop.
Java snippet to override SSL hostname verifier for DEV purposes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for when you encounter this crap in your dev or troubleshooting... | |
// java.security.cert.CertificateException: No name matching somedomain.com found | |
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier( | |
new javax.net.ssl.HostnameVerifier(){ | |
public boolean verify(String hostname, | |
javax.net.ssl.SSLSession sslSession) { | |
return true; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment