和通讯录 v3.9.6版本的 MD5 值为:669178e2ee1b2311daf378bd20c6bbe1
以下内容为反编译后的 HttpUtil.java 源代码,内容仅作参考
package com.cmcc.sso.sdk.util;
import android.text.TextUtils;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.params.HttpClientParams;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
public class HttpUtil {
public static String APK_REQUEST_IP = "http://wap.cmpassport.com:8080/client/queryVersion";
private static final int CONNECT_TIMEOUT_TIME = 20000;
private static final int SO_TIMEOUT_TIME = 20000;
public static HttpResponse doGetRequest(HttpGet httpGet) {
BasicHttpParams basicHttpParams = new BasicHttpParams();
HttpClientParams.setRedirecting(basicHttpParams, false);
DefaultHttpClient defaultHttpClient = new DefaultHttpClient(basicHttpParams);
defaultHttpClient.getParams().setParameter("http.connection.timeout", 20000);
defaultHttpClient.getParams().setParameter("http.socket.timeout", 20000);
return defaultHttpClient.execute(httpGet);
}
public static String getLatestAPKUri() {
try {
HttpResponse doGetRequest = doGetRequest(new HttpGet(APK_REQUEST_IP));
if (doGetRequest == null || 200 != doGetRequest.getStatusLine().getStatusCode()) {
return "";
}
return parseResponse(EntityUtils.toString(doGetRequest.getEntity()));
} catch (ClientProtocolException e) {
e.printStackTrace();
return "";
} catch (IOException e2) {
e2.printStackTrace();
return "";
}
}
private static String parseResponse(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
try {
return new JSONObject(str).optString(SsoSdkConstants.VALUES_KEY_APKURI);
} catch (Exception e) {
return "";
}
}
}