com.sun.gi.utils.nio.*

Can anyone give me a pointer on how this is intended to be used? I seem to be able to setup a server socket and register a listener for connections:


...
    NIOSocketManager sMgr = new NIOSocketManager();
     sMgr.addListener(this);
      SocketAddress s = new InetSocketAddress(9999);
      sMgr.acceptConnectionsOn(s);

This listener gets called but I am not able to properly register an NIOConnectionListener


 public void newConnection(NIOConnection con)
    {
        // This gets called
        System.out.println("NEW CONNECTION");

        try
        {            
            //Guessing here, not sure what else needs to be done..
            con.addListener(thingThatImplementsNIOConnectionListener);

             //This seems to work
            con.send(StringUtils.toByteBuffer("TEST"));
        }
        catch (IOException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }        
    }

Nothing seems to make it to the NIOConnectionListener.

Furthermore, the reason I’m using this is the hope that NIOConnectionListener.receivePacketReceived() will have access to a SimTask.

This is an internal API. It is not supported or gauranteed to remain available in later releases.