package ei.engine.test;

import java.io.IOException;
import java.net.InetAddress;

import ei.engine.network.NioClient;
import ei.engine.network.message.StringMessage;
import ei.engine.network.response.PrintRsp;

public class NetworkClient {
	public static void main(String[] args) {
		try {
			NioClient client = new NioClient(InetAddress.getByName("localhost"), 6056);
			Thread t = new Thread(client);
			t.setDaemon(false);
			t.start();
			for(int i=0;;i++){
				PrintRsp handler = new PrintRsp();			
				client.send(handler, new StringMessage("StringMessage: "+i));
				handler.waitForResponse();
				//try {Thread.sleep(1);} catch (InterruptedException e) {}
				//System.out.println("sending");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
