async-http-client
async-http-client copied to clipboard
can i cancel SSL verification?if so,how should i config DefaultAsyncHttpClientConfig
can i cancel SSL verification?if so,what should i do
@xuelang0823
this.asyncHttpClient = asyncHttpClient(config()
.setSslContext(createSslContext())
private SslContext createSslContext() {
X509TrustManager tm = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
SslProvider sslProvider = SslContext.defaultClientProvider();
SslContextBuilder sslContextBuilder = SslContextBuilder.forClient();
sslContextBuilder.trustManager(tm);
sslContextBuilder.sslProvider(sslProvider);
try {
return sslContextBuilder.build();
} catch (SSLException e) {
throw new RuntimeException(e.getMessage(), e);
}
}