@Override
    public void connect(String id, InetSocketAddress address, int sendBufferSize, int receiveBufferSize) throws IOException {
        if (canConnect == null || canConnect.test(address)) {
            this.connected.add(id);
            this.ready.add(id);
        }
    }
A fake selector to use for testing
clients/src/test/java/org/apache/kafka/test/MockSelector.java