public void ensurePreferIPv4() throws IOException {
    InetAddress[] addrs = InetAddress.getAllByName("localhost");
    for (InetAddress addr : addrs) {
      LOG.info("resolved localhost as:" + addr);
      Assert.assertEquals(4, addr.getAddress().length); // ensure 4 byte ipv4 address
    }
  }
Checks whether we are running with java.net.preferIPv4Stack=true
hbase-server/src/test/java/org/apache/hadoop/hbase/TestIPv6NIOServerSocketChannel.java