juju/juju — pull request #331 by axw (2014-07-18 01:41:21+00:00)
Title: Pass net.Listener into apiserver.NewServer

The dummy provider will soon be changed to
create a net.Listener with an ephemeral port,
and then later use this Listener in its
embedded apiserver.Server.

In this PR, we change apiserver.NewServer
to accept a Listener, as opposed to creating
one internally. This also opens the door to
testing without a TCP-based listener (e.g.
using a mock listener than returns in-memory
net.Conns created with net.Pipe).

This PR also records the ephemeral port as
api-port in the dummy provider's environment
config; this will be used in a future change
to use api-port as the basis of computing the
API server addresses.