'If the request connection is lost while the application object is being
iterated, iteration is stopped.'

def test_connectionClosedDuringIteration(self):

    class UnreliableConnection(Request, ):
        '\n                                                This    is    a    request    which    pretends    its    connection    is    lost    immediately\n                                                after    the    first    write    is    done    to    it.\n                                                '
        def write(self, bytes):
            self.connectionLost(Failure(ConnectionLost('No    more    connection')))
    self.badIter = False
    def appIter():
        (yield 'foo')
        self.badIter = True
        raise Exception('Should    not    have    gotten    here')
    def applicationFactory():
        def application(environ, startResponse):
            startResponse('200    OK', [])
            return appIter()
        return application
    (d, requestFactory) = self.requestFactoryFactory(UnreliableConnection)
    def cbRendered(ignored):
        self.assertFalse(self.badIter, 'Should    not    have    resumed    iteration')
    d.addCallback(cbRendered)
    self.lowLevelRender(requestFactory, applicationFactory, DummyChannel, 'GET', '1.1', [], [''])
    return self.assertFailure(d, ConnectionLost)
