如果不使用代理:
URL url0 = new URL(url);
HttpURLConnection httpConnection = (HttpURLConnection) url0
.openConnection();
responseCode = httpConnection.getResponseCode();
HttpURLConnection httpConnection = (HttpURLConnection) url0
.openConnection();
responseCode = httpConnection.getResponseCode();
使用代理:
System.getProperties()
.put("proxySet", "true");
System.getProperties()
.put("proxyHost", "dfdfdf"); // your proxy host
System.getProperties()
.put("proxyPort", "1234"); // your proxy port
.put("proxySet", "true");
System.getProperties()
.put("proxyHost", "dfdfdf"); // your proxy host
System.getProperties()
.put("proxyPort", "1234"); // your proxy port