typesafehub/activator — pull request #87 by retronym (2013-10-07 09:42:14+00:00)
Title: Use 127.0.0.1 rather than localhost to connect.

A defensive measure after a transient problem I encountered on
my Mac starting activator.

- Refactor `isAlive` to `httpPing`, and turn IOExceptions into
a ping result of false
- Connect to 127.0.0.1 in that ping
- Also use the dotted address when launching the browser.

What was going on on my machine? Netty bound to port 127.0.0.1:8888,
but `waitForServerStartup` couldn't connect. I checked for other
processes on that port, or any other Java processes at all.

I found a related discussion that talks about IPv6 / IPv4:

http://serverfault.com/questions/76211/127-0-0-1-is-working-but-localhost-is-not-working-on-mac-xampp
http://superuser.com/questions/377634/how-can-i-make-localhost-resolve-to-127-0-0-1-instead-of-1

Perhaps the client was trying to connect to to ::1, the IPv6 loopback
address.

See also: http://netty.io/4.0/api/io/netty/util/NetUtil.html

Using the IPv4 loopback address uniformly seems like a safe way
to avoid this problem.