How to handle invalid SSL certificate with Apache client 4.5.5?

后端 未结 1 1957
有刺的猬
有刺的猬 2020-12-20 08:18

I am trying to use Apache Client 4.5.5 to connect to one of my web server.

I am trying to use SSLContextBuilder but it seems its deprecated now, I don\'t want to use

相关标签:
1条回答
  • 2020-12-20 08:37

    Apache HttpClient 4.5.5

    HttpClient httpClient = HttpClients
                .custom()
                .setSSLContext(new SSLContextBuilder().loadTrustMaterial(null, TrustAllStrategy.INSTANCE).build())
                .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
                .build();
    
    0 讨论(0)
提交回复
热议问题