### Question:
ConnectionFactory { public static Connection fromHostList(String... brokers) { return new Connection(Arrays.asList(brokers), _transportFactory.buildTransport(null)); } private  ConnectionFactory(); static Connection fromZookeeper(String zkUrl); static Connection fromProperties(Properties properties); static Connection fromHostList(String... brokers); static Connection fromHostList(List<String> brokers, Map<String, String> headers);  }### Answer:
@Test public void testBrokerList() { String broker1 = "127.0.0.1:1234"; String broker2 = "localhost:2345"; Connection connection = ConnectionFactory.fromHostList(broker1, broker2); List<String> brokers = new ArrayList<String>(); brokers.add(broker1); brokers.add(broker2); Assert.assertEquals(connection.getBrokerList(), brokers); }
@Test public void testBrokerListWithHeaders() { List<String> brokers = new ArrayList<>(); brokers.add("127.0.0.1:1234"); brokers.add("localhost:2345"); Map<String, String> headers = new HashMap<>(); headers.put("Caller", "curl"); Connection connection = ConnectionFactory.fromHostList(brokers, headers); Assert.assertEquals(connection.getBrokerList(), brokers); }