private static void createTopics(String brokerUrl) {
        List<NewTopic> toCreate = new ArrayList<>();
        toCreate.add(new NewTopic(INPUT_TOPIC, 1, (short) 1));
        toCreate.add(new NewTopic(OUTPUT_TOPIC, 1, (short) 1));

        Map<String, Object> config = new HashMap<>();
        config.put("bootstrap.servers", brokerUrl);

        try (AdminClient adminClient = AdminClient.create(config)) {
            adminClient.createTopics(toCreate);
        }
    }
Copy of https://github.com/chbatey/kafka-unit/blob/master/src/main/java/info/batey/kafka/unit/KafkaUnit.java
Some codes have been modified for testing from the copied code.
agent-module/plugins-it/kafka-it/kafka-3-it/src/test/java/test/pinpoint/plugin/kafka/KafkaStreamsUnitServer.java