System.setProperty("http.proxyHost", "www.apache.org");
URL url = new URL("http://www.apache.org");
HttpURLConnection urlConnect = (HttpURLConnection) url
.openConnection();
urlConnect.getInputStream();
assertTrue(urlConnect.usingProxy());
System.setProperty("http.proxyPort", "81");
url = new URL("http://www.apache.org");
urlConnect = (HttpURLConnection) url.openConnection();
urlConnect.getInputStream();