'An endpoint can listen and returns a deferred that gets called back
with a port instance.'

def test_endpointListenSuccess(self):

    mreactor = MemoryReactor()
    factory = object()
    (ep, expectedArgs, expectedHost) = self.createServerEndpoint(mreactor, factory)
    d = ep.listen(factory)
    receivedHosts = []
    def checkPortAndServer(port):
        receivedHosts.append(port.getHost())
    d.addCallback(checkPortAndServer)
    self.assertEqual(receivedHosts, [expectedHost])
    self.assertEqual(self.expectedServers(mreactor), [expectedArgs])
