package net.bakingpowder.jspl.sample;

import net.bakingpowder.jspl.tcprelay.buffering.*;

public class CommandSample {

	public static void main(String[] args) {
		if (args.length!=3){
			System.out.println("Usage: java CommandSample <LocalPort> <DestinationAddress> <DestinationPort>");
			System.exit(-1);
		}
	
		int lport = Integer.parseInt(args[0]);
		int dport = Integer.parseInt(args[2]);
		try {
			TCPRelay mp = new TCPRelay(lport,args[1],dport);
			System.out.println("[Starting TCP Proxy localhost:" + lport + " to "+ args[1] + ":" + dport + "]");
			mp.service_start();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(-1);
		}		
		
		while(true){
			//waiting loop here
		}
	}
}
