@Test
public void testIsLocalHostIdx() throws UnknownHostException, SocketException {

  assertEquals(1, NetUtils.findHostIndex(new String[] { "google.com",
      "127.0.0.1" }));
  assertEquals(2, NetUtils.findHostIndex(new String[] { "microsoft.com",
      "twitter.com", "localhost" }));
  assertEquals(0, NetUtils.findHostIndex(new String[] { "127.1.0.1",
      "cloudera.com", "yahoo.com" }));
  // all the specified names are not local, thus return -1
  assertEquals(-1, NetUtils.findHostIndex(new String[] { "apache.org",
      "cloudera.com", "yahoo.com" }));
}