@Test
public void headersWriteShouldHalfCloseStream() throws Exception {

    writeAllFlowControlledFrames();
    createStream(STREAM_ID, false);
    ChannelPromise promise = newPromise();
    encoder.writeHeaders(ctx, STREAM_ID, EmptyHttp2Headers.INSTANCE, 0, true, promise);
    assertTrue(promise.isSuccess());
    verify(lifecycleManager).closeStreamLocal(eq(stream(STREAM_ID)), eq(promise));
}