@Test
public void trailersDoNotEndStreamThrows() {

    writeAllFlowControlledFrames();
    final int streamId = 6;
    ChannelPromise promise = newPromise();
    encoder.writeHeaders(ctx, streamId, EmptyHttp2Headers.INSTANCE, 0, false, promise);
    ChannelPromise promise2 = newPromise();
    ChannelFuture future = encoder.writeHeaders(ctx, streamId, EmptyHttp2Headers.INSTANCE, 0, false, promise2);
    assertTrue(future.isDone());
    assertFalse(future.isSuccess());
    verify(writer, times(1)).writeHeaders(eq(ctx), eq(streamId), eq(EmptyHttp2Headers.INSTANCE), eq(0),
            eq(DEFAULT_PRIORITY_WEIGHT), eq(false), eq(0), eq(false), eq(promise));
}