0
Registry<ConnectionSocketFactory> reg =RegistryBuilder<ConnectionSocketFactory>create().register("https", new
SSLConnectionSocketFactory(ctx)).register("http", new PlainConnectionSocketFactory())
.build();
PoolingHttpClientConnectionManager cm = newPoolingHttpClientConnectionManager(reg);
client = HttpClients.custom()
.setConnectionManager(cm)
.setDefaultRequestConfig(config)
.setSSLHostnameVerifier(new NoopHostnameVerifier())
.build();
我使用NoopHostnameVerifier,因爲我不想驗證SSL,但在我的ConnectionManager存在必要的邏輯,並沒有機會忘記的ConnectionManager。HttpClient的建立SSLHostnameVerifier和的ConnectionManager同時
的問題是,如果我有和的ConnectionManager SSLHostnameVerifier(NoopHostnameVerifier),我收到以下錯誤:
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
什麼可能導致這個問題?
不工作:( – Alexdharma