This code gave me content but some russian characters hide for me for square… Who know how to set utf-8 or cp1251 charset for proxy to get content. Dance with code do not take any results for me. getBytes and other method can’t give me normal result.
URL url = new URL(linkCar);
String your_proxy_host = new String(proxys.getValueAt(xProxy, 1).toString());
int your_proxy_port = Integer.parseInt(proxys.getValueAt(xProxy, 2).toString());
Proxy proxy = null;
System.out.println(proxys.getValueAt(xProxy, 3).toString());
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(your_proxy_host, your_proxy_port));
HttpURLConnection connection = (HttpURLConnection)url.openConnection(proxy);
connection.setConnectTimeout(16000);
connection.connect();
proxys – table model where list of the proxies;
And may be who know how to set connect throw socks-proxy
for UTF-8, try to change the line
to
you can change the charset name to another one if you want to change the charset.