public static String normalizeHostName(String name) {
    try {
      return InetAddress.getByName(name).getHostAddress();
    } catch (UnknownHostException e) {
      return name;
    }    
  }
@Test
  public void testNormalizeHostName() {
    String oneHost = "1.kanyezone.appspot.com";
    try {
      InetAddress.getByName(oneHost);
    } catch (UnknownHostException e) {
      Assume.assumeTrue("Network not resolving "+ oneHost, false);
    }
    List<String> hosts = Arrays.asList("127.0.0.1",
        "localhost", oneHost, "UnknownHost123");
    List<String> normalizedHosts = NetUtils.normalizeHostNames(hosts);
    String summary = "original [" + StringUtils.join(hosts, ", ") + "]"
        + " normalized [" + StringUtils.join(normalizedHosts, ", ") + "]";
    // when ipaddress is normalized, same address is expected in return
    assertEquals(summary, hosts.get(0), normalizedHosts.get(0));
    // for normalizing a resolvable hostname, resolved ipaddress is expected in return
    assertFalse("Element 1 equal "+ summary,
        normalizedHosts.get(1).equals(hosts.get(1)));
    assertEquals(summary, hosts.get(0), normalizedHosts.get(1));
    // this address HADOOP-8372: when normalizing a valid resolvable hostname start with numeric, 
    // its ipaddress is expected to return
    assertFalse("Element 2 equal " + summary,
        normalizedHosts.get(2).equals(hosts.get(2)));
    // return the same hostname after normalizing a irresolvable hostname.
    assertEquals(summary, hosts.get(3), normalizedHosts.get(3));
  }