'L{AdoptedStreamServerEndpoint.listen} can only be used once.  The file
descriptor given is closed after the first use, and subsequent calls to
C{listen} return a L{Deferred} that fails with L{AlreadyListened}.'

def test_singleUse(self):

    reactor = MemoryReactor()
    endpoint = self._createStubbedAdoptedEndpoint(reactor, 13, AF_INET)
    endpoint.listen(object())
    d = self.assertFailure(endpoint.listen(object()), error.AlreadyListened)
    def listenFailed(ignored):
        self.assertEqual(1, len(reactor.adoptedPorts))
    d.addCallback(listenFailed)
    return d
