How to Connect SOCKS Proxy connection in android emulator, I am able to connect successfully SOCKS Proxy Server on system browser but it not work in emulator, when using System network setting. I have tried
System.setProperty("socksProxyHost", proxyHost);
System.setProperty("socksProxyPort", port);
and also
SocketAddress addr = new InetSocketAddress(proxyHost, proxyPort);
Proxy httpProxy = new Proxy(Proxy.Type.SOCKS, addr);urlConn = url.openConnection(httpProxy);
but Falied. I want to connect and consume SOCKS Proxy connection & Web Service in my App on Device.Thanks in advance.
This works for me on Android 4.3 on rooted Nexus 4 with SSHTunnel running:
SocketAddress proxyAddr = new InetSocketAddress("127.0.0.1", 1984);
SocketAddress hostAddr = new InetSocketAddress(address, port);
java.net.Proxy proxy = new java.net.Proxy(java.net.Proxy.Type.SOCKS, proxyAddr);
socket = new Socket(proxy);
socket.connect(hostAddr);
Note: I also installed iptables beta but I'm not sure if it's required.
For this to work with an emulator change the IP to 10.0.2.2 which is Android's alias for your host machine. You will have to run a local SOCKS proxy on your machine of course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With