private void encodeRequestHeader(HttpRequestChain chain) throws IOException {
        HttpRequest request = chain.request();
        Http2Settings peerHttp2Settings = request.peerHttp2Settings();
        if (peerHttp2Settings != null) {
            int headerTableSize = peerHttp2Settings.getHeaderTableSize();
            if (headerTableSize != -1) {
                mHpackRequestWriter.setHeaderTableSizeSetting(headerTableSize);
            }
        }
        byte[] headerBlock = mHpackRequestWriter.writeRequestHeaders(request.method(),
                request.path(), request.host(), request.requestHeaders());
        sendHeaderBlockFrame(chain, headerBlock, peerHttp2Settings, request.streamId(),
                request.requestStreamEnd());
    }
Encodes HTTP2 request and response packets.

@author Megatron King
@since 2019/1/5 14:24
netbare-core/src/main/java/com/github/megatronking/netbare/http2/Http2EncodeInterceptor.java