Github user anmolnar commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/451#discussion_r166329760 --- Diff: src/java/test/org/apache/zookeeper/test/StaticHostProviderTest.java --- @@ -117,8 +116,32 @@ public void testTwoInvalidHostAddresses() { list.add(new InetSocketAddress("a", 2181)); list.add(new InetSocketAddress("b", 2181)); new StaticHostProvider(list); + } + + @Test + public void testReResolving() { + byte size = 1; + ArrayList<InetSocketAddress> list = new ArrayList<InetSocketAddress>(size); + + // Test a hostname that resolves to multiple addresses + list.add(InetSocketAddress.createUnresolved("www.apache.org", 1234)); --- End diff -- Good point I spent hours finding a way for it. Unfortunately static members can't be mocked with Mockito. We should use PowerMock for it (as described here https://blog.codecentric.de/en/2016/03/junit-testing-using-mockito-powermock/), but that'd be a new dependency not sure if it's acceptable here.
---