@Test
public void writabilityAndFlowControl() {

    LastInboundHandler inboundHandler = streamActiveAndWriteHeaders(inboundStream);
    Http2StreamChannel childChannel = (Http2StreamChannel) inboundHandler.channel();
    assertEquals("", inboundHandler.writabilityStates());
    // HEADERS frames are not flow controlled, so they should not affect the flow control window.
    childChannel.writeAndFlush(new DefaultHttp2HeadersFrame(new DefaultHttp2Headers()));
    codec.onHttp2StreamWritabilityChanged(childChannel.stream(), true);
    assertEquals("true", inboundHandler.writabilityStates());
    codec.onHttp2StreamWritabilityChanged(childChannel.stream(), true);
    assertEquals("true", inboundHandler.writabilityStates());
    codec.onHttp2StreamWritabilityChanged(childChannel.stream(), false);
    assertEquals("true,false", inboundHandler.writabilityStates());
    codec.onHttp2StreamWritabilityChanged(childChannel.stream(), false);
    assertEquals("true,false", inboundHandler.writabilityStates());
}