### Question:
InetAddressUtils { public static InetAddress resolveHostname(final String hostname, final boolean preferInet6Address) throws UnknownHostException { return resolveHostname(hostname, preferInet6Address, true); }  static InetAddress getLocalHostAddress(); static String getLocalHostAddressAsString(); static String getLocalHostName(); static String incr(final String address); static byte[] incr(final byte[] address); static String decr(final String address); static byte[] decr(final byte[] address); static InetAddress getInetAddress(final int[] octets, final int offset, final int length); static InetAddress getInetAddress(final byte[] ipAddrOctets); static InetAddress getInetAddress(final String dottedNotation); static InetAddress resolveHostname(final String hostname, final boolean preferInet6Address); static InetAddress resolveHostname(final String hostname, final boolean preferInet6Address, final boolean throwException); static byte[] toIpAddrBytes(final String dottedNotation); static String toIpAddrString(final InetAddress addr); static String toIpAddrString(final byte[] addr); static InetAddress getLowestInetAddress(final List<InetAddress> addresses); static BigInteger difference(final String addr1, final String addr2); static BigInteger difference(final InetAddress addr1, final InetAddress addr2); static boolean isInetAddressInRange(final byte[] laddr, final String beginString, final String endString); static boolean isInetAddressInRange(final String addrString, final String beginString, final String endString); static boolean inSameScope(final InetAddress addr1, final InetAddress addr2); static boolean isInetAddressInRange(final byte[] addr, final byte[] begin, final byte[] end); static boolean isInetAddressInRange(final String ipAddr, final byte[] begin, final byte[] end); static InetAddress convertCidrToInetAddressV4(int cidr); static InetAddress convertCidrToInetAddressV6(int cidr); static InetAddress convertBigIntegerIntoInetAddress(final BigInteger i); static InetAddress addr(final String ipAddrString); static String normalize(final String ipAddrString); static String str(final InetAddress addr); static BigInteger toInteger(final InetAddress ipAddress); static String toOid(final InetAddress addr); static byte[] macAddressStringToBytes(String macAddress); static String macAddressBytesToString(byte[] macAddress); static String normalizeMacAddress(String macAddress); static final InetAddress UNPINGABLE_ADDRESS; static final InetAddress UNPINGABLE_ADDRESS_IPV6; static final InetAddress ZEROS; static final InetAddress TWO_FIFTY_FIVES; static final InetAddress ONE_TWENTY_SEVEN; }### Answer:
@Test @Ignore public void testPreferIPv6() throws Exception { InetAddressUtils.resolveHostname("ipv4.www.yahoo.com", false); try { InetAddressUtils.resolveHostname("ipv4.www.yahoo.com", true); fail(); } catch (UnknownHostException e) { } try { InetAddressUtils.resolveHostname("ipv6.www.yahoo.com", false); fail(); } catch (UnknownHostException e) { } InetAddressUtils.resolveHostname("ipv6.www.yahoo.com", true); }
@Test @Ignore public void testLookup() throws Exception { InetAddress fb = InetAddressUtils.resolveHostname("www.opennms.org", false); assertNotNull(fb); }