@Test
public void dataWriteToHalfClosedLocalStreamShouldFail() throws Exception {

    createStream(STREAM_ID, true);
    ByteBuf data = mock(ByteBuf.class);
    ChannelPromise promise = newPromise();
    encoder.writeData(ctx, STREAM_ID, data, 0, false, promise);
    assertTrue(promise.isDone());
    assertFalse(promise.isSuccess());
    assertThat(promise.cause(), instanceOf(IllegalStateException.class));
    verify(data).release();
}