@Test
public void dataWriteShouldCreateHalfClosedStream() throws Exception {

    writeAllFlowControlledFrames();
    Http2Stream stream = createStream(STREAM_ID, false);
    ByteBuf data = dummyData();
    ChannelPromise promise = newPromise();
    encoder.writeData(ctx, STREAM_ID, data.retain(), 0, true, promise);
    assertTrue(promise.isSuccess());
    verify(remoteFlow).addFlowControlled(eq(stream), any(FlowControlled.class));
    verify(lifecycleManager).closeStreamLocal(stream, promise);
    assertEquals(data.toString(UTF_8), writtenData.get(0));
    data.release();
}