Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use TorLib to avoid DNS leaks

htran_888Nov 3 2009 — edited Dec 10 2009
Dear Forum Members,

I need some advice on how best to run Tor in Java when using TorLib to avoid DNS leaks. My difficulty is how to use the TorLib class in the code snippet below to connect to a webserver:
      .....
      String url = "http://www.abc.com/index.html",
      URL server = new URL(url);
      Properties systemProperties = System.getProperties();
      systemProperties.setProperty("socks.ProxyHost","localhost");
      systemProperties.setProperty("socks.ProxyPort",9050);
      HttpURLConnection connection = (HttpURLConnection) server.openConnection();
      ......
Do I need to instantiate a new socket and how to use it to point to Tor?

Apologies for asking Tor question in a Java Forum since I could not find the right forum. It would be great if you could direct me to one.

Any assistance would be appreciated.

Thanks,

Jack
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 7 2010
Added on Nov 3 2009
2 comments
816 views