Add support of 127.0.0.1 hostname for unit test
Switch to use 127.0.0.1 instead of localhost since on OSX pycurl refuse to look-up localhost in DNS