Connect to loopback address instead of localhost name
This fixes issues with localhost being IPv6 aware, i.e. the name
"localhost" may resolve to "::1". This failed because the client
explicitly connected to the IPv4 loopback address (127.0.0.1).