📜  org.apache.http.client.httpclient 设置 tls 版本 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:16.679000             🧑  作者: Mango

代码示例1
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
  SSLContexts.createDefault(),
  new String[] { "TLSv1.2", "TLSv1.3" },
  null,
  SSLConnectionSocketFactory.getDefaultHostnameVerifier());

CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build();