public boolean finishConnect() throws IOException {
        //we need to grab remoteAddr before finishConnect() is called otherwise
        //it becomes inaccessible if the connection was refused.
        SocketChannel socketChannel = transportLayer.socketChannel();
        if (socketChannel != null) {
            remoteAddress = socketChannel.getRemoteAddress();
        }
        boolean connected = transportLayer.finishConnect();
        if (connected) {
            if (ready()) {
                state = ChannelState.READY;
            } else if (remoteAddress != null) {
                state = new ChannelState(ChannelState.State.AUTHENTICATE, remoteAddress.toString());
            } else {
                state = ChannelState.AUTHENTICATE;
            }
        }
        return connected;
    }
Does handshake of transportLayer and authentication using configured authenticator.
For SSL with client authentication enabled, {@link TransportLayer#handshake()} performs
authentication. For SASL, authentication is performed by {@link Authenticator#authenticate()}.
clients/src/main/java/org/apache/kafka/common/network/KafkaChannel.java