private void useFixedBrokerPort() throws IOException {
        // Find a free port and use it in the Kafka broker's listeners config. We can't use port 0 in the listeners
        // config to get a random free port because in this test we want to stop the Kafka broker and then bring it
        // back up and listening on the same port in order to verify that the Connect cluster can re-connect to Kafka
        // and continue functioning normally. If we were to use port 0 here, the Kafka broker would most likely listen
        // on a different random free port the second time it is started. Note that we can only use the static port
        // because we have a single broker setup in this test.
        int listenerPort;
        try (ServerSocket s = new ServerSocket(0)) {
            listenerPort = s.getLocalPort();
        }
        brokerProps.put(SocketServerConfigs.LISTENERS_CONFIG, String.format("EXTERNAL://localhost:%d,CONTROLLER://localhost:0", listenerPort));
        connectBuilder
                .numBrokers(1)
                .brokerProps(brokerProps);
    }
If a connector has existing tasks, and then generates new task configs, workers compare the
new and existing configs before publishing them to the config topic. If there is no difference,
workers do not publish task configs (this is a workaround to prevent infinite loops with eager
rebalancing).
<p>
This test tries to guarantee that, if the old task configs become invalid because of
an invalid config provider reference, it will still be possible to reconfigure the connector.
connect/runtime/src/test/java/org/apache/kafka/connect/integration/ConnectWorkerIntegrationTest.java