Fix name constant used in Inet6Address.LOOPBACK

In Android M, the name for the IPv6 loopback was set as
"ip6-localhost" to match the /etc/hosts file. The switch
to OpenJDK partly reverted this, but only the hardcoded
name on Inet6Address.LOOPBACK.

Looking up "localhost" and "ip6-localhost" by name
still yielded the correct result, i.e. the IPv4 and IPv6
address accordingly.

The inconsistency only appears to lie in the name
constant. This change adds an explicit check for the
names: previously it was only hinted at.

Also reinstitute some DNS lookup testing.

Test: Ran CTS/android.core.tests.libcore.package.okhttp
Test: Ran CTS/android.core.tests.libcore.package.libcore
Test: Ran CTS/android.core.tests.libcore.package.harmony_java_net

Bug: 29311351
(cherry picked from commit 21d479dc790dfe7b9f0d38b3820b49b563ce734a)

Change-Id: I4291827c5534236ccbe8e93ed16cb5942bf2d509
2 files changed