Mercurial > hg > RemoteEditor > REPSessionManager
view test/channeltest/testEditor.java @ 378:c78569ab5fce
*** empty log message ***
author | kono |
---|---|
date | Wed, 22 Oct 2008 04:27:52 +0900 |
parents | 1eec69035548 |
children |
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 = REPLogger.singleton(); } public void run(){ try { REPSocketChannel<String> channel; channel = REPSocketChannel.<String>create(new StringPacker()); channel.configureBlocking(true); ns.writeLog("try to connect to SessionManager whose ip is "+semaIP, 1); while (!channel.connect(semaIP)){ ns.writeLog("SeMa not listen to socket yet, wait", 1); Thread.yield(); } ns.writeLog("successes to connect", 1); channel.write(getName()+": send hello"); ns.writeLog("wrote packet", 1); String packet = channel.read(); ns.writeLog("gets return string==> `"+packet+"\'", 1); ns.writeLog("testEditor exits.", 1); } catch (IOException e) { } } }