'WindowUpdate frames received after we\'ve completed the stream are
safely handled.'

def test_windowUpdateForCompleteStream(self):

    f = FrameFactory()
    b = StringTransport()
    a = H2Connection()
    a.requestFactory = DummyProducerHandlerProxy
    requestBytes = f.clientConnectionPreface()
    requestBytes += buildRequestBytes(self.getRequestHeaders, [], f)
    a.makeConnection(b)
    for byte in iterbytes(requestBytes):
        a.dataReceived(byte)
    stream = a.streams[1]
    request = stream._request.original
    cleanupCallback = a._streamCleanupCallbacks[1]
    request.unregisterProducer()
    request.finish()
    self.assertTrue(request.finished)
    a.dataReceived(f.buildWindowUpdateFrame(streamID=1, increment=50).serialize())
    def validate(streamID):
        frames = framesFromBytes(b.value())
        self.assertEqual(len(frames), 3)
        self.assertTrue(('END_STREAM' in frames[(-1)].flags))
        dataChunks = [f.data for f in frames if isinstance(f, hyperframe.frame.DataFrame)]
        self.assertEqual(dataChunks, [''])
    return cleanupCallback.addCallback(validate)
