public void register(String id, SocketChannel socketChannel) throws IOException {
        ensureNotRegistered(id);
        registerChannel(id, socketChannel, SelectionKey.OP_READ);
        this.sensors.connectionCreated.record();
        // Default to empty client information as the ApiVersionsRequest is not
        // mandatory. In this case, we still want to account for the connection.
        ChannelMetadataRegistry metadataRegistry = this.channel(id).channelMetadataRegistry();
        if (metadataRegistry.clientInformation() == null)
            metadataRegistry.registerClientInformation(ClientInformation.EMPTY);
    }
Register the nioSelector with an existing channel
Use this on server-side, when a connection is accepted by a different thread but processed by the Selector
<p>
If a connection already exists with the same connection id in `channels` or `closingChannels`,
an exception is thrown. Connection ids must be chosen to avoid conflict when remote ports are reused.
Kafka brokers add an incrementing index to the connection id to avoid reuse in the timing window
where an existing connection may not yet have been closed by the broker when a new connection with
the same remote host:port is processed.
</p><p>
If a `KafkaChannel` cannot be created for this connection, the `socketChannel` is closed
and its selection key cancelled.
</p>
clients/src/main/java/org/apache/kafka/common/network/Selector.java