org.jgroups.util

Class Proxy1_4


public class Proxy1_4
extends java.lang.Object

Redirects incoming TCP connections to other hosts/ports. All redirections are defined in a file as for example
 127.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  -keypass 
 
Start the Proxy as follows:
 java -Djavax.net.ssl.keyStore=/home/bela/.keystore -Djavax.net.ssl.keyStorePassword=
      -Djavax.net.ssl.trustStore=/home/bela/.keystore -Djavax.net.ssl.trustStorePassword=
      org.jgroups.util.Proxy1_4 -file /home/bela/map.properties
 
Start client as follows:
 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  -file server.crt.der
 
This will store the server's certificate in the ${user.home}/.keystore key store.
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. todo Check whether SSLSocket.getChannel() or SSLServerSocket.getChannel() works

Author:
Bela Ban

Constructor Summary

Proxy1_4(InetAddress local, int local_port, InetAddress remote, int remote_port, boolean verbose, boolean debug)
Proxy1_4(InetAddress local, int local_port, InetAddress remote, int remote_port, boolean verbose, boolean debug, String mapping_file)

Method Summary

static void
main(String[] args)
void
start()

Constructor Details

Proxy1_4

public Proxy1_4(InetAddress local,
                int local_port,
                InetAddress remote,
                int remote_port,
                boolean verbose,
                boolean debug)


Proxy1_4

public Proxy1_4(InetAddress local,
                int local_port,
                InetAddress remote,
                int remote_port,
                boolean verbose,
                boolean debug,
                String mapping_file)

Method Details

main

public static void main(String[] args)


start

public void start()
            throws Exception


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.