Specify a non-zero port when testing localhost resolution.

Some getaddrinfo implementations (including OS X 10.6) fail
if we try to resolve port 0 without AI_PASSIVE.

Closes #1136.