HttpGet with HTTPS : SSLPeerUnverifiedException

前端 未结 6 1670
旧时难觅i
旧时难觅i 2020-11-27 13:29

Using HttpClient, I receive the following error when attempting to communicate over HTTPS:

Exception in thread \"main\" javax.net.ssl.SSLPeerUnverifie

6条回答
  •  情深已故
    2020-11-27 13:48

    Using HttpClient 3.x, you need to do this:

    Protocol easyHttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443);
    Protocol.registerProtocol("https", easyHttps);
    

    An implementation of EasySSLProtocolSocketFactory can be found here.

提交回复
热议问题