private void processSelectedKeys(Set keys) throws Exception {
        Iterator itr = keys.iterator();
        while (itr.hasNext()) {
            SelectionKey key = (SelectionKey) itr.next();
            if (key.isReadable()) processRead(key);
            if (key.isWritable()) processWrite(key);
            if (key.isConnectable()) processConnect(key);
            if (key.isAcceptable()) ;
            itr.remove();
        }
    }