SelectionKey sk = (SelectionKey) iterator.next();
iterator.remove();
KeyAttachment attachment = (KeyAttachment)sk.attachment();
try {
if ( sk.isValid() && attachment != null ) {
attachment.access();
sk.attach(attachment);
sk.interestOps(0); //this is a must, so that we don't have multiple threads messing with the socket
attachment.interestOps(0);
NioChannel channel = attachment.getChannel();
if (sk.isReadable() || sk.isWritable() ) {