private ConnectionState connectionState(String idString) {
        ConnectionState connectionState = connections.get(idString);
        if (connectionState == null) {
            connectionState = new ConnectionState();
            connections.put(idString, connectionState);
        }
        return connectionState;
    }
A mock network client for use testing code
clients/src/test/java/org/apache/kafka/clients/MockClient.java