Using 127.0.0.1 instead of localhost to avoid ipv4/ipv6 issue

This is an attempt to fix the hanging of some of the tests on Travis CI.
The idea being that the lookup of localhost in /etc/hosts is taking time
for some reason, perhaps localhost is resolving to ::1 which is the
loopback address for ipv6.