Java Code Examples for java.net.Inet6Address.getByName()

The following are Jave code examples for showing how to use getByName() of the java.net.Inet6Address class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File: TestTableInputFormatBase.java   Source Code and License Vote up 6 votes
@Test
public void testTableInputFormatBaseReverseDNSForIPv6()
    throws UnknownHostException, NamingException {
  String address = "ipv6.google.com";
  String localhost = null;
  InetAddress addr = null;
  TableInputFormat inputFormat = new TableInputFormat();
  try {
    localhost = InetAddress.getByName(address).getCanonicalHostName();
    addr = Inet6Address.getByName(address);
  } catch (UnknownHostException e) {
    // google.com is down, we can probably forgive this test.
    return;
  }
  System.out.println("Should retrun the hostname for this host " +
      localhost + " addr : " + addr);
  String actualHostName = inputFormat.reverseDNS(addr);
  assertEquals("Should retrun the hostname for this host. Expected : " +
      localhost + " Actual : " + actualHostName, localhost, actualHostName);
}
 
Example 2
Project: fuck_zookeeper   File: ZKTestCase.java   Source Code and License Vote up 5 votes
protected void assumeIPv6Available() {
    try {
        InetAddress address = Inet6Address.getByName("0:0:0:0:0:0:0:1");
        Assume.assumeTrue(address.isReachable(1000));
    } catch (IOException exception) {
        Assume.assumeTrue(false);
    }
}
 
Example 3
Project: ZooKeeper   File: ZKTestCase.java   Source Code and License Vote up 5 votes
protected void assumeIPv6Available() {
    try {
        InetAddress address = Inet6Address.getByName("0:0:0:0:0:0:0:1");
        Assume.assumeTrue(address.isReachable(1000));
    } catch (IOException exception) {
        Assume.assumeTrue(false);
    }
}