Mercurial > hg > RemoteEditor > REPSessionManager
view test/channeltest/testEditor.java @ 172:a776ec9ed848
*** empty log message ***
author | kono |
---|---|
date | Thu, 28 Aug 2008 18:57:17 +0900 |
parents | fafbaaa0abd0 |
children | 72252e970a8b |
line wrap: on
line source
package test.channeltest; import java.io.IOException; import java.net.InetSocketAddress; import java.net.SocketAddress; import rep.channel.REPLogger; import rep.channel.REPSocketChannel; public class testEditor extends Thread{ private SocketAddress semaIP; private REPLogger ns; public testEditor(String name, String _host,int _port){ super(name); semaIP = new InetSocketAddress(_host, _port); ns = testNetworkSimulator.ns; } public void run(){ try { REPSocketChannel<String> channel; channel = REPSocketChannel.<String>create(); ns.writeLog(this, "try to connect to SessionManager whose ip is "+semaIP, 1); while (!channel.connect(semaIP)){ ns.writeLog(this, "SeMa not listen to socket yet, wait", 1); Thread.yield(); } ns.writeLog(this, "successes to connect", 1); channel.write("from "+getName()+": hello"); ns.writeLog(this, "wrote packet", 1); String packet = channel.read(); ns.writeLog(this, "gets return string==> `"+packet+"\'", 1); ns.writeLog(this, "testEditor exits.", 1); } catch (IOException e) { } } }