### Question:
ZooKeeperMainServerArg { public String parse(final Configuration c) { Properties zkProps = ZKConfig.makeZKProps(c); String host = null; String clientPort = null; for (Entry<Object, Object> entry: zkProps.entrySet()) { String key = entry.getKey().toString().trim(); String value = entry.getValue().toString().trim(); if (key.startsWith("server.") && host == null) { String[] parts = value.split(":"); host = parts[0]; } else if (key.endsWith("clientPort")) { clientPort = value; } if (host != null && clientPort != null) break; } return host != null && clientPort != null? host + ":" + clientPort: null; }  String parse(final Configuration c); static void main(String args[]);  }### Answer:
@Test public void test() { Configuration c = HBaseConfiguration.create(); assertEquals("localhost:" + c.get("hbase.zookeeper.property.clientPort"), parser.parse(c)); final String port = "1234"; c.set("hbase.zookeeper.property.clientPort", port); c.set("hbase.zookeeper.quorum", "example.com"); assertEquals("example.com:" + port, parser.parse(c)); c.set("hbase.zookeeper.quorum", "example1.com,example2.com,example3.com"); assertTrue(port, parser.parse(c).matches("example[1-3]\\.com:" + port)); }