'A L{IFileDescriptor.connectionLost} implementation which raises an
exception does not prevent the remaining L{IFileDescriptor}s from
having their C{connectionLost} method called.'

def test_shutdownDisconnectsCleanly(self):

    lostOK = [False]
    class ProblematicFileDescriptor(FileDescriptor, ):
        def connectionLost(self, reason):
            raise RuntimeError('simulated    connectionLost    error')
    class OKFileDescriptor(FileDescriptor, ):
        def connectionLost(self, reason):
            lostOK[0] = True
    reactor = self.buildReactor()
    fds = iter([ProblematicFileDescriptor(), OKFileDescriptor()])
    reactor.removeAll = (lambda : fds)
    reactor.callWhenRunning(reactor.stop)
    self.runReactor(reactor)
    self.assertEqual(len(self.flushLoggedErrors(RuntimeError)), 1)
    self.assertTrue(lostOK[0])
