我正在使用apache apache-httpcomponents-httpcore.jar
和apache-httpcomponents-httpclient.jar
版本4.1并遵循本教程here,它在文章中清楚地表明它支持HttpClient< 4.3但我在代码中遇到语法错误。
这里:
1. SSLSocketFactory sf = new SSLSocketFactory(easyStrategy,SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
2. SchemeRegistry registry = new SchemeRegistry();
3. registry.register(new Scheme("https", 8443, sf));
4. ClientConnectionManager ccm = new ThreadSafeClientConnManager(registry);
5. client = new DefaultHttpClient(ccm);
在所有这些中它表示构造函数未定义
答案 0 :(得分:0)
您可能导入了javax.net.ssl.SSLSocketFactory而不是Apache。