public static AdminBootstrapAddresses fromConfig(AbstractConfig config) {
        List<String> bootstrapServers = config.getList(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG);
        if (bootstrapServers == null) {
            bootstrapServers = Collections.emptyList();
        }
        List<String> controllerServers = config.getList(AdminClientConfig.BOOTSTRAP_CONTROLLERS_CONFIG);
        if (controllerServers == null) {
            controllerServers = Collections.emptyList();
        }
        String clientDnsLookupConfig = config.getString(CommonClientConfigs.CLIENT_DNS_LOOKUP_CONFIG);
        if (bootstrapServers.isEmpty()) {
            if (controllerServers.isEmpty()) {
                throw new ConfigException("You must set either " +
                        CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + " or " +
                        AdminClientConfig.BOOTSTRAP_CONTROLLERS_CONFIG);
            } else {
                return new AdminBootstrapAddresses(true,
                    ClientUtils.parseAndValidateAddresses(controllerServers, clientDnsLookupConfig));
            }
        } else {
            if (controllerServers.isEmpty()) {
                return new AdminBootstrapAddresses(false,
                    ClientUtils.parseAndValidateAddresses(bootstrapServers, clientDnsLookupConfig));
            } else {
                throw new ConfigException("You cannot set both " +
                        CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG + " and " +
                        AdminClientConfig.BOOTSTRAP_CONTROLLERS_CONFIG);
            }
        }
    }
@Test
    public void testTwoBootstrapsSet() {
        Map<String, Object> map = new HashMap<>();
        map.put(AdminClientConfig.BOOTSTRAP_CONTROLLERS_CONFIG, "localhost:9092");
        map.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
        AdminClientConfig config = new AdminClientConfig(map);
        assertEquals("You cannot set both bootstrap.servers and bootstrap.controllers",
                assertThrows(ConfigException.class, () -> AdminBootstrapAddresses.fromConfig(config)).
                        getMessage());
    }