80,337
社区成员
发帖
与我相关
我的任务
分享
HttpParams params =new BasicHttpParams();
ConnManagerParams.setTimeout(params, 45000);
HttpConnectionParams.setConnectionTimeout(params, 45000);
HttpConnectionParams.setSoTimeout(params, 45000);
// 设置我们的HttpClient支持HTTP和HTTPS两种模式
SchemeRegistry schReg =new SchemeRegistry();
schReg.register(new Scheme("http", PlainSocketFactory
.getSocketFactory(), 80));
schReg.register(new Scheme("https", SSLSocketFactory
.getSocketFactory(), 443));
// 使用线程安全的连接管理来创建HttpClient
ClientConnectionManager conMgr =new ThreadSafeClientConnManager(
params, schReg);
client =new DefaultHttpClient(conMgr, params);