'Create an L{AdoptedStreamServerEndpoint} which may safely be used with
an invalid file descriptor.  This is convenient for a number of unit
tests.'

def _createStubbedAdoptedEndpoint(self, reactor, fileno, addressFamily):

    e = endpoints.AdoptedStreamServerEndpoint(reactor, fileno, addressFamily)
    e._close = (lambda fd: None)
    e._setNonBlocking = (lambda fd: None)
    return e
