private void encodeResponseHeader(HttpResponseChain chain) throws IOException {
        HttpResponse response = chain.response();
        Http2Settings clientHttp2Settings = response.clientHttp2Settings();
        if (clientHttp2Settings != null) {
            int headerTableSize = clientHttp2Settings.getHeaderTableSize();
            if (headerTableSize != -1) {
                mHpackResponseWriter.setHeaderTableSizeSetting(headerTableSize);
            }
        }
        byte[] headerBlock = mHpackResponseWriter.writeResponseHeaders(response.code(),
                response.message(), response.responseHeaders());
        sendHeaderBlockFrame(chain, headerBlock, clientHttp2Settings, response.streamId(),
                response.responseStreamEnd());
    }
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