Add test for resolving a host to an address

The IPv6 change in b146d74 made a bunch of tests fail because they could not
connect to 'localhost'. They could not connect because only the first result
from getaddrinfo(3) was used, which happened to be the IPv6 `localhost`
address. This commit changes those tests to use '127.0.0.1' and adds a test
that explicitly tests that the client can resolve 'localhost'.