Skip to content

Instantly share code, notes, and snippets.

@Artur-at-work
Artur-at-work / disable_SSL_and_hostname_verification.java
Created May 2, 2020 07:34 — forked from mingliangguo/disable_SSL_and_hostname_verification.java
disable SSL and host name verification for apache httpclient
try {
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) { }
public void checkServerTrusted(X509Certificate[] certs, String authType) { }
}