'The H2Stream data implements IPushProducer, and can have its data
production controlled by the Request if the Request chooses to.
When the production is stopped, that causes the stream connection to
be lost.'

def test_abortStreamProducingData(self):

    f = FrameFactory()
    b = StringTransport()
    a = H2Connection()
    a.requestFactory = AbortingConsumerDummyHandlerProxy
    frames = buildRequestFrames(self.postRequestHeaders, self.postRequestData, f)
    frames[(-1)].flags = set()
    requestBytes = f.clientConnectionPreface()
    requestBytes += ''.join((f.serialize() for f in frames))
    a.makeConnection(b)
    for byte in iterbytes(requestBytes):
        a.dataReceived(byte)
    request = a.streams[1]._request.original
    self.assertFalse(request._requestReceived)
    cleanupCallback = a._streamCleanupCallbacks[1]
    request.acceptData()
    def validate(streamID):
        frames = framesFromBytes(b.value())
        self.assertEqual(len(frames), 2)
        self.assertTrue(isinstance(frames[(-1)], hyperframe.frame.RstStreamFrame))
        self.assertEqual(frames[(-1)].stream_id, 1)
    return cleanupCallback.addCallback(validate)
