Mercurial > hg > RemoteEditor > REPSessionManager
view rep/channel/ServerChannelSimulator.java @ 123:5b1a0574b406 add-simulator
*** empty log message ***
author | pin |
---|---|
date | Wed, 27 Aug 2008 17:21:25 +0900 |
parents | |
children | 785a3e8ea858 |
line wrap: on
line source
package rep.channel; import java.io.IOException; import java.nio.channels.ClosedChannelException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.spi.SelectorProvider; public class ServerChannelSimulator<P>extends SelectableChannelSimulator<P>{ protected NetworkSimulator<P> ns; private int virtualIP; /** Constructors. */ public ServerChannelSimulator(NetworkSimulator<P> _ns, SelectorSimulator<P> rselector){ super(null); ns = _ns; readSelector = rselector; writeSelector = null; qread = null; qwrite = null; } /** Connecting methods */ // for servers. public void bind(int ip){ virtualIP = ip; ns.listen(ip, readSelector); } public ChannelSimulator<P> accept(){ ChannelSimulator<P> channel = ns.accept(virtualIP); return channel; } /* state check methods for SelectionKeySimulator. */ public boolean isReadable() { return false; } public boolean isWritable() { return false; } public boolean isAcceptable() { return ns.canAccept(virtualIP); } @Override public Object blockingLock() { // TODO Auto-generated method stub return null; } @Override public SelectableChannel configureBlocking(boolean block) throws IOException { // TODO Auto-generated method stub return null; } @Override public boolean isBlocking() { // TODO Auto-generated method stub return false; } @Override public boolean isRegistered() { // TODO Auto-generated method stub return false; } @Override public SelectionKey keyFor(Selector sel) { // TODO Auto-generated method stub return null; } @Override public SelectorProvider provider() { // TODO Auto-generated method stub return null; } @Override public SelectionKey register(Selector sel, int ops, Object att) throws ClosedChannelException { // TODO Auto-generated method stub return null; } @Override public int validOps() { // TODO Auto-generated method stub return 0; } @Override protected void implCloseChannel() throws IOException { // TODO Auto-generated method stub } public static ServerSocketChannel open() { // TODO Auto-generated method stub return null; } }