解决asynchttpclient https请求报错hostname in certificate didn't match:
来源:互联网 发布:吃土(网络词汇) 编辑:程序博客网 时间:2024/06/07 23:01
错误:
javax.NET.ssl.SSLException:hostname in certificate didn’t match:<..*.com> != <.**.com>
解决办法:
public static SchemeRegistry getSchemeRegistry() { try { KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null, null); SSLSocketFactory sf = new MySSLSocketFactory(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, 10000); HttpConnectionParams.setSoTimeout(params, 10000); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.UTF_8); SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); registry.register(new Scheme("https", sf, 443)); return registry; } catch (Exception e) { return null; } }
asynchttpclient 初始化的时候 new AsyncHttpClient(getSchemeRegistry()); 传入这个方法返回值就可以了。
阅读全文
0 0
- 解决asynchttpclient https请求报错hostname in certificate didn't match:
- HttpClient 访问Https报错hostname in certificate didn't match:
- HttpClient请求https,抛出javax.net.ssl.SSLException: hostname in certificate didn't match:
- HttpsURLConnection请求https,抛出javax.net.ssl.SSLException: hostname in certificate didn't match:
- HttpClient访问报错 javax.net.ssl.SSLException: hostname in certificate didn't match
- Maven 报错:hostname in certificate didn’t match 的解决方法
- httpclient对象请求:如果报这个错:javax.net.ssl.SSLException: hostname in certificate didn't match证书不匹配的主机名
- Android 链接https出现 javax.net.ssl.SSLException: hostname in certificate didn't match:
- Android 链接https出现 javax.net.ssl.SSLException: hostname in certificate didn't match:
- Android 链接https出现 javax.net.ssl.SSLException: hostname in certificate didn't match:
- Android 链接https出现 javax.net.ssl.SSLException: hostname in certificate didn't match:
- Android 链接https出现 javax.net.ssl.SSLException: hostname in certificate didn't match:
- Android SDK下载异常(hostname in certificate didn't match)
- javax.net.ssl.SSLException: hostname in certificate didn't match:
- javax.net.ssl.SSLException: hostname in certificate didn't match:
- android SDK 更新出现“hostname in certificate didn't match: <dl-ssl.google.com>”解决方法
- android SDK 更新出现“hostname in certificate didn't match: <dl-ssl.google.com>”解决方法
- Android javax.net.ssl.SSLException: hostname in certificate didn't match...
- C++新特性之lambda表达式在for_each循环中的使用及for循环新写法
- 分布式架构实战--ActiveMQ的安装与使用(单节点)
- [JZOJ100020]B
- MFC控件—ListControl
- 解决Maven项目相互依赖/循环依赖/双向依赖的问题
- 解决asynchttpclient https请求报错hostname in certificate didn't match:
- jsp页面作为一个子页面嵌套到另一个jsp页面中
- spring整合web项目
- nginx 配置 使jsp页面转向tomcat处理
- 如何有效合并两个文件:一个是1亿条的用户基本信息,另一个是用户每天看电影连续剧等的记录,5000万条。其中内存只有1G。
- RedHat下Oracle开机自启动
- Ecology8.1 系统中前端代码在IE8等低版本中不能执行的简单解决办法
- kubernetes安装配置文件详解
- execute immediate 用法