private void tryFeature(String featureName, boolean supported, Invoker invoker, ResultTester resultTester)
            throws Throwable {
        try {
            invoker.invoke();
            log.info("Successfully used feature {}", featureName);
        } catch (UnsupportedVersionException e) {
            log.info("Got UnsupportedVersionException when attempting to use feature {}", featureName);
            if (supported) {
                throw new RuntimeException("Expected " + featureName + " to be supported, but it wasn't.", e);
            }
            return;
        }
        if (!supported) {
            throw new RuntimeException("Did not expect " + featureName + " to be supported, but it was.");
        }
        resultTester.test();
    }
ClientCompatibilityTest is invoked by the ducktape test client_compatibility_features_test.py to validate
client behavior when various broker versions are in use.  It runs various client operations and tests whether they
are supported or not.
tools/src/main/java/org/apache/kafka/tools/ClientCompatibilityTest.java