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:
1 2 3 4 5
| ... 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public void newConnection(NIOConnection con) { System.out.println("NEW CONNECTION");
try { con.addListener(thingThatImplementsNIOConnectionListener);
con.send(StringUtils.toByteBuffer("TEST")); } catch (IOException e) { 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.