'Calls to L{_WrappingFactory.clientConnectionLost} should errback the
L{_WrappingFactory._onConnection} L{Deferred}'

def test_clientConnectionFailed(self):

    wf = endpoints._WrappingFactory(TestFactory())
    expectedFailure = Failure(error.ConnectError(string='fail'))
    wf.clientConnectionFailed(None, expectedFailure)
    errors = []
    def gotError(f):
        errors.append(f)
    wf._onConnection.addErrback(gotError)
    self.assertEqual(errors, [expectedFailure])
