@Test
public void streamShouldBeOpenInListener() {

    final Http2FrameStream stream2 = frameCodec.newStream();
    assertEquals(State.IDLE, stream2.state());
    final AtomicBoolean listenerExecuted = new AtomicBoolean();
    channel.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()).stream(stream2))
            .addListener(new ChannelFutureListener() {
                @Override
                public void operationComplete(ChannelFuture future) throws Exception {
                    assertTrue(future.isSuccess());
                    assertEquals(State.OPEN, stream2.state());
                    listenerExecuted.set(true);
                }
            });
    assertTrue(listenerExecuted.get());
}