public static void writeHttp2Headers(ChannelHandlerContext ctx, OutboundMsgHolder outboundMsgHolder,
                                         Http2ClientChannel http2ClientChannel, Http2ConnectionEncoder encoder,
                                         int streamId, HttpHeaders headers, Http2Headers http2Headers,
                                         boolean endStream) throws Http2Exception {
        int dependencyId = headers.getInt(HttpConversionUtil.ExtensionHeaderNames.STREAM_DEPENDENCY_ID.text(), 0);
        short weight = headers.getShort(HttpConversionUtil.ExtensionHeaderNames.STREAM_WEIGHT.text(),
                Http2CodecUtil.DEFAULT_PRIORITY_WEIGHT);
        for (Http2DataEventListener dataEventListener : http2ClientChannel.getDataEventListeners()) {
            if (!dataEventListener.onHeadersWrite(ctx, streamId, http2Headers, endStream)) {
                return;
            }
        }

        encoder.writeHeaders(ctx, streamId, http2Headers, dependencyId, weight, false, 0, endStream, ctx.newPromise());
        encoder.flowController().writePendingBytes();
        ctx.flush();

        if (endStream) {
            outboundMsgHolder.setRequestWritten(true);
        }
    }
public static void writeHttp2Headers ( ChannelHandlerContext ctx , OutboundMsgHolder outboundMsgHolder , Http2ClientChannel http2ClientChannel , Http2ConnectionEncoder encoder , int streamId , HttpHeaders headers , Http2Headers http2Headers , boolean endStream ) throws Http2Exception { int dependencyId = headers . getInt ( HttpConversionUtil . ExtensionHeaderNames . STREAM_DEPENDENCY_ID . text ( ) , 0 ) ; short weight = headers . getShort ( HttpConversionUtil . ExtensionHeaderNames . STREAM_WEIGHT . text ( ) , Http2CodecUtil . DEFAULT_PRIORITY_WEIGHT ) ; for ( Http2DataEventListener dataEventListener : http2ClientChannel . getDataEventListeners ( ) ) { if ( ! dataEventListener . onHeadersWrite ( ctx , streamId , http2Headers , endStream ) ) { return ; } } encoder . writeHeaders ( ctx , streamId , http2Headers , dependencyId , weight , false , 0 , endStream , ctx . newPromise ( ) ) ; encoder . flowController ( ) . writePendingBytes ( ) ; ctx . flush ( ) ; if ( endStream ) { outboundMsgHolder . setRequestWritten ( true ) ; } }
Writes HTTP2 headers.

@param ctx                the channel handler context
@param outboundMsgHolder  the outbound message holder
@param http2ClientChannel the client channel related to the handler
@param encoder            the HTTP2 connection encoder
@param streamId           the id of the stream
@param headers            the HTTP headers
@param http2Headers       the HTTP2 headers
@param endStream          is this the end of stream
@throws Http2Exception if a protocol-related error occurred