Skip to content

Instantly share code, notes, and snippets.

@ran488
Created August 11, 2011 13:39
Show Gist options
  • Save ran488/1139678 to your computer and use it in GitHub Desktop.
Save ran488/1139678 to your computer and use it in GitHub Desktop.
Java snippet to override SSL hostname verifier for DEV purposes
// 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