The following always prints the first returned IPv4 address and not the first IPv6 address although I explicitly used Inet6Adress and not InetAddress. Is this a bug in the OpenJDK 1.7.0 I use?
InetAddress ipv6 = Inet6Address.getByName("www.google.com");
How am I supposed to get one IPv6 adresse for a given host name (or NULL if none exists)?
I do not want to change the resolver preference between IPv4 and IPv6, in this case I really want to see if at least one IPv6 address exists.
It's probably doable by iterating all results of InetAddress.getAllByName() and check for any "instanceof Inet6Address" but that does not look like the supposed way to do it.