RbChat v4.56630229版本的 MD5 值为:d137f4b55d6b64b50641a810905f5957
以下内容为反编译后的 bo.java 源代码,内容仅作参考
package com.paypal.android.sdk;
import android.content.Context;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.params.ConnManagerParams;
import org.apache.http.conn.params.ConnPerRouteBean;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.SyncBasicHttpContext;
public final class bo {
private static int a = 10;
private static int b = 10000;
private final DefaultHttpClient c;
private final HttpContext d;
private ThreadPoolExecutor e;
private final Map f;
private final Map g;
public bo() {
BasicHttpParams basicHttpParams = new BasicHttpParams();
ConnManagerParams.setTimeout(basicHttpParams, b);
ConnManagerParams.setMaxConnectionsPerRoute(basicHttpParams, new ConnPerRouteBean(a));
ConnManagerParams.setMaxTotalConnections(basicHttpParams, 10);
HttpConnectionParams.setSoTimeout(basicHttpParams, b);
HttpConnectionParams.setConnectionTimeout(basicHttpParams, b);
HttpConnectionParams.setTcpNoDelay(basicHttpParams, true);
HttpConnectionParams.setSocketBufferSize(basicHttpParams, 8192);
HttpProtocolParams.setVersion(basicHttpParams, HttpVersion.HTTP_1_1);
HttpProtocolParams.setUserAgent(basicHttpParams, String.format("android-async-http/%s (http://loopj.com/android-async-http)", "1.4.3"));
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
ThreadSafeClientConnManager threadSafeClientConnManager = new ThreadSafeClientConnManager(basicHttpParams, schemeRegistry);
this.d = new SyncBasicHttpContext(new BasicHttpContext());
DefaultHttpClient defaultHttpClient = new DefaultHttpClient(threadSafeClientConnManager, basicHttpParams);
this.c = defaultHttpClient;
defaultHttpClient.addRequestInterceptor(new bp(this));
defaultHttpClient.addResponseInterceptor(new bq(this));
defaultHttpClient.setHttpRequestRetryHandler(new bx(5));
this.e = (ThreadPoolExecutor) Executors.newCachedThreadPool();
this.f = new WeakHashMap();
this.g = new HashMap();
}
private void a(DefaultHttpClient defaultHttpClient, HttpContext httpContext, HttpUriRequest httpUriRequest, String str, bt btVar, Context context) {
if (str != null) {
httpUriRequest.addHeader("Content-Type", str);
}
Future<?> submit = this.e.submit(new bs(defaultHttpClient, httpContext, httpUriRequest, btVar));
if (context != null) {
List list = (List) this.f.get(context);
if (list == null) {
list = new LinkedList();
this.f.put(context, list);
}
list.add(new WeakReference(submit));
}
}
public final HttpClient a() {
return this.c;
}
public final void a(int i) {
HttpParams params = this.c.getParams();
ConnManagerParams.setTimeout(params, i);
HttpConnectionParams.setSoTimeout(params, i);
HttpConnectionParams.setConnectionTimeout(params, i);
}
public final void a(Context context, String str, Header[] headerArr, bt btVar) {
HttpDelete httpDelete = new HttpDelete(str);
if (headerArr != null) {
httpDelete.setHeaders(headerArr);
}
a(this.c, this.d, (HttpUriRequest) httpDelete, (String) null, btVar, context);
}
public final void a(Context context, String str, Header[] headerArr, bw bwVar, bt btVar) {
HttpGet httpGet = new HttpGet(str);
if (headerArr != null) {
httpGet.setHeaders(headerArr);
}
a(this.c, this.d, (HttpUriRequest) httpGet, (String) null, btVar, context);
}
public final void a(Context context, String str, Header[] headerArr, HttpEntity httpEntity, String str2, bt btVar) {
HttpPost httpPost = new HttpPost(str);
if (httpEntity != null) {
httpPost.setEntity(httpEntity);
}
if (headerArr != null) {
httpPost.setHeaders(headerArr);
}
a(this.c, this.d, (HttpUriRequest) httpPost, (String) null, btVar, context);
}
public final void a(Context context, boolean z) {
List<WeakReference> list = (List) this.f.get(context);
if (list != null) {
for (WeakReference weakReference : list) {
Future future = (Future) weakReference.get();
if (future != null) {
future.cancel(true);
}
}
}
this.f.remove(context);
}
public final void a(String str) {
HttpProtocolParams.setUserAgent(this.c.getParams(), str);
}
public final void a(ThreadPoolExecutor threadPoolExecutor) {
this.e = threadPoolExecutor;
}
public final void a(SSLSocketFactory sSLSocketFactory) {
this.c.getConnectionManager().getSchemeRegistry().register(new Scheme("https", sSLSocketFactory, 443));
}
}