apcera/gnatsd — pull request #31 by krobertson (2014-05-27 16:13:12+00:00)
Title: Added Server.Addr() helper to allow querying of the server's bound address

This can be useful in testing scenarios by allowing you to have the system pick
a random port by passing 0 on options.Port, but also give the user a way to
query the server for what port it actually bound to.

This change can also be useful because the behavior on some systems is that the OS will reuse a random port if it is unbound. For instance, create a listener on port 0, close the socket, give that port to gnatsd, and something else gets that port in the short time in between.