@Override
    public void flush() throws TTransportException {
        final THttp2ClientInitializer initHandler = new THttp2ClientInitializer();

        final Bootstrap b = new Bootstrap();
        b.group(group);
        b.channel(NioSocketChannel.class);
        b.handler(initHandler);

        Channel ch = null;
        try {
            ch = b.connect(host, port).syncUninterruptibly().channel();
            final THttp2ClientHandler handler = initHandler.clientHandler;

            // Wait until HTTP/2 upgrade is finished.
            await().untilAsserted(() -> assertThat(handler.settingsPromise.isDone()).isTrue());
            handler.settingsPromise.get();

            // Send a Thrift request.
            final FullHttpRequest request = new DefaultFullHttpRequest(
                    HttpVersion.HTTP_1_1, HttpMethod.POST, path,
                    Unpooled.wrappedBuffer(out.getArray(), 0, out.length()));
            request.headers().add(HttpHeaderNames.HOST, host);
            request.headers().set(ExtensionHeaderNames.SCHEME.text(), uri.getScheme());
            request.headers().add(defaultHeaders);
            ch.writeAndFlush(request).sync();

            // Wait until the Thrift response is received.
            assertTrue(handler.responsePromise.await(5, TimeUnit.SECONDS));
            final ByteBuf response = handler.responsePromise.get();

            // Pass the received Thrift response to the Thrift client.
            final byte[] array = new byte[response.readableBytes()];
            response.readBytes(array);
            in = new TMemoryInputTransport(array);
            response.release();
        } catch (Exception e) {
            throw new TTransportException(TTransportException.UNKNOWN, e);
        } finally {
            if (ch != null) {
                ch.close();
            }
        }
    }
An extremely simple Thrift-over-HTTP/2 client which sends and receives a single Thrift request/response
per connection.
thrift/thrift0.13/src/test/java/com/linecorp/armeria/server/thrift/AbstractTHttp2Client.java