return errorCode;
}
//TODO pobierac serwery proxy z innej strony
private URLConnection getConnection(URL url, int proxyNum) throws Exception{
SocketAddress addr = null;
Proxy proxy = null;
switch (proxyNum) {
case 0:
System.out.println("Get default gateway");
return url.openConnection();
case 1:
System.out.println("Get 91.204.161.125 gateway");
addr = new InetSocketAddress("91.204.161.125", 80);
proxy = new Proxy(Proxy.Type.HTTP, addr);
return url.openConnection(proxy);
case 2:
System.out.println("Get 203.160.1.75 gateway");
addr = new InetSocketAddress("203.160.1.75", 80);
proxy = new Proxy(Proxy.Type.HTTP, addr);
return url.openConnection(proxy);
case 3:
System.out.println("Get 212.95.49.87 gateway");
addr = new InetSocketAddress("212.95.49.87", 80);
proxy = new Proxy(Proxy.Type.HTTP, addr);
return url.openConnection(proxy);
case 4:
System.out.println("Get 193.173.119.83 gateway");
addr = new InetSocketAddress("193.173.119.83", 8080);
proxy = new Proxy(Proxy.Type.HTTP, addr);
return url.openConnection(proxy);
case 5:
System.out.println("Get 159.148.82.3 gateway");
addr = new InetSocketAddress("159.148.82.3", 3128);
proxy = new Proxy(Proxy.Type.HTTP, addr);
return url.openConnection(proxy);
case 6:
System.out.println("Get 194.44.170.81 gateway");
addr = new InetSocketAddress("194.44.170.81", 3128);
proxy = new Proxy(Proxy.Type.HTTP, addr);
return url.openConnection(proxy);
default:
System.out.println("No another gateway");
return null;
}