Package org.jgroups.util
Class Proxy
- java.lang.Object
-
- org.jgroups.util.Proxy
-
public class Proxy extends java.lang.Object
Redirects incoming TCP connections to other hosts/ports. All redirections are defined in a file as for example127.0.0.1:8888=www.ibm.com:80 localhost:80=pop.mail.yahoo.com:110
The first line forwards all requests to port 8888 on to www.ibm.com at port 80 (it also forwards the HTTP response back to the sender. The second line essentially provides a POP-3 service on port 8110, using Yahoo's POP service. This is neat when you're behind a firewall and one of the few services in the outside world that are not blocked is port 80 (HHTP).
Note that JDK 1.4 is required for this class. Also, concurrent.jar has to be on the classpath. Note that you also need to include jsse.jar/jce.jar (same location as rt.jar) if you want SSL sockets.
To create SSLServerSockets you'll need to do the following: Generate a certificate as follows:keytool -genkey -keystore /home/bela/.keystore -keyalg rsa -alias bela -storepass
Start the Proxy as follows:-keypass java -Djavax.net.ssl.keyStore=/home/bela/.keystore -Djavax.net.ssl.keyStorePassword=
Start client as follows:-Djavax.net.ssl.trustStore=/home/bela/.keystore -Djavax.net.ssl.trustStorePassword= org.jgroups.util.Proxy -file /home/bela/map.properties java -Djavax.net.ssl.trustStore=/home/bela/.keystore -Djavax.net.ssl.trustStorePassword=
sslclient
To import a certificate into the keystore, use the following steps:openssl x509 -in server.crt -out server.crt.der -outform DER keytool -import -trustcacerts -alias
This will store the server's certificate in the ${user.home}/.keystore key store.-file server.crt.der
Note that an SSL client or server can be debugged by starting it as follows:-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol -Djavax.net.debug=ssl
If you run a web browser, simply enter https://: as URL to connect to an SSLServerSocket
Note that we cannot use JDK 1.4's selectors for SSL sockets, as getChannel() on an SSL socket doesn't seem to work.- Author:
- Bela Ban
- To do:
- Check whether SSLSocket.getChannel() or SSLServerSocket.getChannel() works.
-
-
Constructor Summary
Constructors Constructor Description Proxy(java.net.InetAddress local, int local_port, java.net.InetAddress remote, int remote_port, boolean verbose, boolean debug)
Proxy(java.net.InetAddress local, int local_port, java.net.InetAddress remote, int remote_port, boolean verbose, boolean debug, java.lang.String mapping_file)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
void
start()
-
-
-
Constructor Detail
-
Proxy
public Proxy(java.net.InetAddress local, int local_port, java.net.InetAddress remote, int remote_port, boolean verbose, boolean debug)
-
Proxy
public Proxy(java.net.InetAddress local, int local_port, java.net.InetAddress remote, int remote_port, boolean verbose, boolean debug, java.lang.String mapping_file)
-
-