代理设置
?
?
测试代理
public static String doRequest(String path){
HttpGet httpGet = new HttpGet(path);
httpGet.setHeader("User-Agent","zol");
HttpParams params = new BasicHttpParams(); ??
HttpHost ?proxy = new HttpHost("10.0.2.2",8000) ;
HttpConnectionParams.setSoTimeout(params, 20 * 1000); ??
HttpConnectionParams.setSocketBufferSize(params, 8192); ??
HttpClient client = new DefaultHttpClient(params);
client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy) ;
try {
HttpResponse response = client.execute(httpGet);
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { ?
?
? ? ? ? ?} ??
?String str = EntityUtils.toString(response.getEntity());
// ?Log.v("fdsfsdfsdf", str);
?return str;
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return path;
}
?
?
模拟器代理的设置for appenginer?
settings->Wireless controls->Mobile networks->Access Point Names W)?
emulator -avd android22 -http-proxy 10.0.2.2:8000
或者使用直接操作数据库方法http://xusaomaiss.iteye.com/blog/373353
?
代码设置代理http://www.linuxidc.com/Linux/2010-08/27749.htm