-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Description
The SSL/TLS certificate verification is disabled. This is a security issue (which makes connections vulnerable to MITM attacks).
Here is a quick test that can be tested with a server that has a self-signed certificate or issued by a CA that's not in the default truststore. URLConnection
will fail as expected (sun.security.validator.ValidatorException: PKIX path building failed
), whereas SimpleAsyncHttpClient
will work just fine.
String hostname = "https://somehost/";
try {
URLConnection connection = new URL(hostname).openConnection();
connection.connect();
} catch (Exception e) {
e.printStackTrace();
}
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder()
.setUrl(hostname).build();
client.get(new BodyConsumer() {
@Override
public void consume(ByteBuffer buffer) throws IOException {
System.out.print(new String(buffer.array(), "UTF-8"));
}
@Override
public void close() throws IOException {
}
});
Please remove anything that has to do with the TrustingSSLSocketFactory
in com.ning.http.client.providers.apache.TrustingSSLSocketFactory
.