Try to get peer hostname from SocketAddress

Java 7 added a new method to InetSocketAddress called getHostString()
which returns the unresolved host for a given address. This should be
suitable for use with SNI as long as it isn't an IP address.

This also helps with testing because we can use serialization tricks to
rewrite the "hostname" field of an already-serialized loopback address.

Bug: 27271561
Change-Id: I9845e57d505712cdfee87d18246a1a3b021deea3
4 files changed