1import java.net.*;
2import java.io.*;
3
4public class StaticIspProxyExample {
5 public static void main(String[] args) throws Exception {
6 Proxy proxy = new Proxy(Proxy.Type.HTTP,
7 new InetSocketAddress("isp.proxxxymiron.com", 6769));
8
9 Authenticator.setDefault(new Authenticator() {
10 protected PasswordAuthentication getPasswordAuthentication() {
11 return new PasswordAuthentication(
12 "username", "password".toCharArray());
13 }
14 });
15
16 URL url = new URL("http://ip.proxxxymiron.com/");
17 HttpURLConnection conn =
18 (HttpURLConnection) url.openConnection(proxy);
19
20 BufferedReader in = new BufferedReader(
21 new InputStreamReader(conn.getInputStream()));
22 String line;
23 while ((line = in.readLine()) != null) {
24 System.out.println(line);
25 }
26 in.close();
27 }
28}