Fix InetSocketAddress.getHostString(): return the name if available

getHostString() would return the IP address in one of the three
scenarios possible:

1) InetSocketAddress created with a name - already worked, name returned.
2) InetSocketAddress create with an InetAddress with only an address - already worked,
  address returned.
3) InetSocketAddress create with an InetAddress with an address and name: would return
the address.

Change-Id: Id9d1addda5cef589ac56db5397e00e842cf8c5d7
When connecting to a SOCKS proxy, use the resolved IP

Noticed while inspecting the code. In HttpURLConnection a similar
change was made recently (commit
797fdc6cc6bf16372e9464f189b535148f944ce9).

Previously if the Proxy was specified with a resolved
InetSocketAddress (i.e. one with a specific IP address already
determined) the hostname would still be used to work out an IP
address to connect to. For host names with multiple IPs the host
connected to could be a different one than the one specified.

Now if the InetAddress has been resolved it will be used. In the
case where the InetAddress is bad this may delay DNS / resolution
errors to later in the connection process. It will, however, avoid
the "connect to a different host" issue, and avoid a reverse DNS
lookup here when the host is not yet known.

Change-Id: I46df5c38942f2d356ba2fd4541e0269021fd6496