/** * Multithreaded local proxy for a server past a firewall. * Usage: LocalProxy proxy-host proxy-port (local-port remote-host remote-port)+ * * Usage examples: * java LocalProxy www-proxy 80 4444 domain.com 143 * local port 4444 --> domain.com:143 via www-proxy proxy server * * java LocalProxy www-proxy 1080 4444 domain.com 143 4445 domain.com 993 * local port 4444 --> domain.com:143 * local port 4445 --> domain.com:993 * * I use this program to connect to mail server past a company * proxy server. I set up a .bat file to run something like * the first example above and then point my mail client (netscape) at * IMAP server at localhost and port 4444. * * Caveat 1: I know this works for my company's proxy server, I don't * know the exact other proxy flavors that will work. * * Caveat 2: There is a lot of noise that gets printed to stdout. * Comment out the prints if they bothers you, but I like it. * * Note: The way that the proxy works is that you make a connection to * the proxy server, ignore all text (the until you see two consecutive * new lines (\r\f or acs(13)asc(10)) then send the text: * * CONNECT remotehost:remoteport HTTP/1.1\n\n * * Note 2: This program can also be used to monitor the traffic that * between the client program and the remote-host. It is pretty frightening * how much gets sent in plaintext -- like mail passwords. To see the traffic * just uncomment the printBuffer command below. Note * that if you are transferring binary data the output is a mess. **/