SSLContextBuilder builder = new SSLContextBuilder();
builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build(), SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
CloseableHttpClient client = HttpClients.custom().setSSLSocketFactory(sslsf).build();
HttpGet httpGet = new HttpGet(url);
CloseableHttpResponse httpResp = client.execute(httpGet);
在连接url地址的时候采用了信任的自签名,所以默认认为这个的SSL Certificate证书是有效的。如果不用信任的自签名,在这里我该如何验证SSL Certificate证书是否是有效的?如何验证改连接的SSL Certificate证书有效期?