java.security.cert.CertificateException

java.security.cert.CertificateException

javax.net.ssl.SSLPeerUnverifiedException

final RestTemplate restTemplate = new RestTemplate();
restTemplate.setRequestFactory(new SimpleClientHttpRequestFactory() {
@Override
protected void prepareConnection(HttpURLConnection connection, String httpMethod) throws IOException {
if (connection instanceof HttpsURLConnection) {
((HttpsURLConnection) connection).setHostnameVerifier(PROMISCUOUS_VERIFIER);
}
super.prepareConnection(connection, httpMethod);
}
});//访问https禁用证书检查

猜你喜欢

转载自www.cnblogs.com/xsj891107/p/10036727.html