Skip to content

Instantly share code, notes, and snippets.

View duleitony's full-sized avatar

Lei Du duleitony

View GitHub Profile
@duleitony
duleitony / InsecureHttpClient.java
Created June 14, 2016 05:17 — forked from jabbrwcky/InsecureHttpClient.java
A sample how to configure Apache HTTPClient (4.+) to accept SSL connections *without* certificate and hostname validation
package net.hausherr.sample;
import org.apache.http.client.CookieStore;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.routing.HttpRoutePlanner;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;