private void decodeGoAway(ByteBuffer buffer, int length, byte flags, int streamId)
            throws IOException {
        if (length < 8) {
            throw new IOException("Http2 TYPE_GOAWAY length < 8: " + length);
        }
        if (streamId != 0) {
            throw new IOException("Http2 TYPE_GOAWAY streamId != 0");
        }
        int initPosition = buffer.position();
        int lastStreamId = buffer.getInt();
        int errorCodeInt = buffer.getInt();
        int opaqueDataLength = length - 8;
        ErrorCode errorCode = ErrorCode.fromHttp2(errorCodeInt);
        if (errorCode == null) {
            throw new IOException("Http2 TYPE_GOAWAY unexpected error code: " + errorCodeInt);
        }
        mLog.e("Http2 TYPE_GOAWAY error code: " + errorCode + " last stream: " + lastStreamId);
        if (opaqueDataLength > 0) { // Must read debug data in order to not corrupt the connection.
            byte[] debugData = new byte[opaqueDataLength];
            buffer.get(debugData);
            mLog.e("Http2 TYPE_GOAWAY debug data: " + new String(debugData));
        }
        buffer.position(initPosition);
    }
Decodes HTTP2 request and response packets.

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