@Override
        protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
            if (msg instanceof Http2Settings) {
                settingsPromise.setSuccess(null);
                return;
            }

            if (msg instanceof FullHttpResponse) {
                final FullHttpResponse res = (FullHttpResponse) msg;
                final Integer streamId = res.headers().getInt(
                        HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text());
                if (streamId == null) {
                    responsePromise.tryFailure(new AssertionError("message without stream ID: " + msg));
                    return;
                }

                if (streamId == 1) {
                    // Response to the upgrade request, which is OK to ignore.
                    return;
                }

                if (streamId != 3) {
                    responsePromise.tryFailure(new AssertionError("unexpected stream ID: " + msg));
                    return;
                }

                responsePromise.setSuccess(res.content().retain());
                return;
            }

            throw new IllegalStateException("unexpected message type: " + msg.getClass().getName());
        }
A handler that triggers the cleartext upgrade to HTTP/2 by sending an initial HTTP request.
thrift/thrift0.13/src/test/java/com/linecorp/armeria/server/thrift/AbstractTHttp2Client.java