Util { public static boolean isIPv6(InetAddress a) { return (a instanceof Inet6Address); } private  Util(); static byte[] addressToBytes(String address); static boolean identical(byte[] b, byte[] b2); static void validatePort(int port); static InetSocketAddress computeLocalEndpoint(
            NetworkInterface ni, InetAddress localAddress, Integer localPort, InetAddress address, Integer port); static boolean isIPv4(InetAddress a); static boolean isIPv6(InetAddress a); static String inetAddressToString(InetAddress a); static void displayInfo(); static void dumpState(Configuration c, DatagramSocket s, DatagramPacket p); static String truncate(byte[] payload, int length); static final Pattern IPv4_FORMAT; }
@Test public void isIPv6_Null() throws Exception { assertFalse(Util.isIPv6(null)); }
@Test public void isIPv6_IPv4() throws Exception { assertFalse(Util.isIPv6(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}))); }
@Test public void isIPv6_IPv6() throws Exception { assertTrue(Util.isIPv6(InetAddress.getByAddress(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}))); }