@Test
    void rpcTApplicationException() throws Exception {
        final String request =
                "{\n" +
                "  \"method\" : \"doDebug\",\n" +
                "  \"type\" : \"EXCEPTION\",\n" +
                "  \"seqid\" : 101,\n" +
                "  \"args\" : {\n" +
                "    \"type\" : 4,\n" +
                "    \"message\" : \"bad_seq_id\"\n" +
                "    }\n" +
                "  }\n" +
                '}';

        TTextProtocol prot = new TTextProtocol(
                new TIOStreamTransport(new ByteArrayInputStream(request.getBytes())));
        final TMessage header = prot.readMessageBegin();
        final TApplicationException result = TApplicationExceptions.read(prot);
        prot.readMessageEnd();

        assertThat(header.name).isEqualTo("doDebug");
        assertThat(header.type).isEqualTo(TMessageType.EXCEPTION);
        assertThat(header.seqid).isEqualTo(101);

        assertThat(result.getType()).isEqualTo(TApplicationException.BAD_SEQUENCE_ID);

        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        prot = new TTextProtocol(new TIOStreamTransport(outputStream));
        prot.writeMessageBegin(header);
        new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "bad_seq_id").write(prot);
        prot.writeMessageEnd();

        assertThatJson(new String(outputStream.toByteArray(), StandardCharsets.UTF_8)).isEqualTo(request);
    }
Read in (deserialize) a thrift message in TTextProtocol format
from a file on disk, then serialize it back out to a string.
Finally, deserialize that string and compare to the original
message.
thrift/thrift0.13/src/test/java/com/linecorp/armeria/common/thrift/text/TTextProtocolTest.java