code: private void accept(final SelectionKey key) throws IOException {
      final ServerSocketChannel serverChannel = (ServerSocketChannel) key.channel();
  
      if (serverChannel.isOpen()) {
        final SocketChannel clientChannel = serverChannel.accept();
    
        clientChannel.configureBlocking(false);
    
        final SelectionKey clientChannelKey = clientChannel.register(selector, SelectionKey.OP_READ);
    
        clientChannelKey.attach(new RawMessageBuilder(messageBuffer.capacity()));
      }
    }
docs: ====================================