HttpClient 如何忽略证书验证 - ALLOW_ALL_HOSTNAME_VERIFIER
1。设置可以访问HTTPS
Function - getNewHttpClient
Java代码
/**
* @Title: getNewHttpClient
* @Description: Methods Description
* @param @return
* @return HttpClient
* @throws
*/
private HttpClient getNewHttpClient() {
try {
KeyStore trustStore = KeyStore.getInstance(KeyStore
.getDefaultType());
trustStore.load(null, null);
SSLSocketFactory sf = new SSLSocketFactory(trustStore);
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(pa