且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置用于使用HttpsURLConnection创建的套接字的密码和协议列表?

更新时间:2022-05-31 22:13:44

SSLSocketFactory 通过 SSLContext.getSocketFactory()获取并将其包装在 SSLSocketFactory 的自定义子类中,该委托代理从 SSLContext 获得的那个,但在 createSocket()中也设置了所需的密码。

Take the SSLSocketFactory obtained by SSLContext.getSocketFactory() and wrap it in a custom subclass of SSLSocketFactory, which delegates to the one obtained from SSLContext, but in createSocket() also sets the required cipher.