proxy - Launch options to force Java socket connections to localhost? -


I am trying to find a way to force any connection, which is a jar externally by my proxy server It does the eye, which is running on the local host (a Java application too) once the proxy server receives the connection, it opens a connection with the external IP and starts routing the IO to the client / server.

I'm Googling it for 2 days, I had some luck, I believe I am using the wrong conditions in my search efforts.

If you have any ideas, please tell me, I will try anything.

Thanks in advance - Sean.

If this is a "real" proxy, you can specify a proxy to use Java < / P>

You have two options:

  1. Specify a proxy in the command line
  2. Make it hard code in your app

OK, you actually have three

  1. Specify the .properties file, and read from there, and set it as a system property (which is a lot of options Is, lake Neither 2 more dynamic)

You will use from the command line:

  java -Dhttp.proxyHost = localhost -Dhttp.proxyPort = 8080 -jar yourJar. Jar  

All the http connection made by you to localhost on the port 8080

Add it to the main method of your program:

  public static zero main (string [] args) {System.setProperty ("http.proxyHost", "localhost"); System.setProperty ("http.proxy port", "8080");  

That's what it does.

Finally loading from myapp.properties

  public static zero main (string [] algs) {try {// there Cleaner methods are resinsbundal bundle = resourcebundle.getbundle ("map"); System.setProperty ("http.proxyHost", Bundle .getString ("Proxy Server")); System.setProperty ("http.proxyPort", bundle.get string ("proxy .port")); } Hold (MissingResource Exception RSOS Exception) {} ....}  

You need to make sure that myapp.properties is available from the class

More information about this functionality


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -