public static String generateConnectionId(Socket socket, int connectionIndex) {
        String localHost = socket.getLocalAddress().getHostAddress();
        int localPort = socket.getLocalPort();
        String remoteHost = socket.getInetAddress().getHostAddress();
        int remotePort = socket.getPort();
        return localHost + ":" + localPort + "-" + remoteHost + ":" + remotePort + "-" + connectionIndex;
    }
Generates a unique connection ID for the given socket.

@param socket The socket for which the connection ID is to be generated.
@param connectionIndex The index to be used in the connection ID to ensure uniqueness.
@return A string representing the unique connection ID.
clients/src/main/java/org/apache/kafka/common/network/Selector.java