// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst 
// Source File Name:   TcpTunnel.java
// Class Version:      45.3

package org.apache.soap.util.net;

import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;

// Referenced classes of package org.apache.soap.util.net:
//            Relay

// flag ACC_SUPER is set
public class TcpTunnel
{
    // Constants:          99
    // Interfaces:         0
    // Fields:             0
    // Methods:            2
    // Class Attributes:   1


    // Decompiling method: <init>  Signature: ()V
    // Max stack: 1, #locals: 1, #params: 1
    // Code length: 5 bytes, Code offset: 1250
    // Line Number Table found: 1 entries
    // Parameter  0 added: Name this Type Lorg/apache/soap/util/net/TcpTunnel; At 0 5 Range 0 4 Init 0 fixed
    // RetValue   1 added: Name <returnValue> Type V At 0 5 Range 0 4 Init 0 fixed
    public TcpTunnel()
    {
        super();
        return;
    }

    // Decompiling method: main  Signature: ([Ljava/lang/String;)V
    // Max stack: 5, #locals: 7, #params: 1
    // Code length: 171 bytes, Code offset: 1293
    // Line Number Table found: 20 entries
    // Parameter  0 added: Name args Type [Ljava/lang/String; At 0 171 Range 0 170 Init 0
    // RetValue   7 added: Name <returnValue> Type V At 0 171 Range 0 170 Init 0 fixed
    // LocalVar   1 added: Name i Type I At 24 75 Range 24 98 Init 24
    // LocalVar   2 added: Name s Type Ljava/lang/String; At 28 89 Range 28 116 Init 28
    // LocalVar   3 added: Name j Type I At 35 73 Range 35 107 Init 35
    // LocalVar   4 added: Name serversocket Type Ljava/net/ServerSocket; At 66 4 Range 66 69 Init 66
    // LocalVar   5 added: Name socket Type Ljava/net/Socket; At 73 85 Range 73 157 Init 73
    // LocalVar   6 added: Name socket1 Type Ljava/net/Socket; At 84 69 Range 84 152 Init 84
    public static void main(String args[])
        throws IOException
    {
        if(args.length != 3)
        {
            System.err.println("Usage: java TcpTunnel listenport tunnelhost tunnelport");
            System.exit(1);
        }
        int i = Integer.parseInt(args[0]);
        String s = args[1];
        int j = Integer.parseInt(args[2]);
        System.out.println("TcpTunnel: ready to rock and roll on port " + i);
        ServerSocket serversocket = new ServerSocket(i);
        do
        {
            Socket socket = serversocket.accept();
            Socket socket1 = new Socket(s, j);
            System.out.println("TcpTunnel: tunnelling port " + i + " to port " + j + " on host " + s);
            (new Relay(socket.getInputStream(), socket1.getOutputStream(), null)).start();
            (new Relay(socket1.getInputStream(), socket.getOutputStream(), null)).start();
        } while(true);
    }
}
