protected void cancel( SelectionKey key, SocketChannel c ) throws IOException
        {
            NioEndpoint p = (NioEndpoint)key.attachment();            
            log.log( Level.FINE, "Closing channel endpoint:{0}.", p );
            Object o = endpointKeys.remove(p);

            log.log( Level.FINE, "Endpoint keys size:{0}", endpointKeys.size() );

            key.cancel();
            c.close();
            removeEndpoint( p, c );
        }
Because we want to keep the keys to ourselves, we'll do
 the endpoint -&gt; key mapping internally.
jme3-networking/src/main/java/com/jme3/network/kernel/tcp/SelectorKernel.java