void handleT8nRequest(
      final HttpServerRequest req,
      final ObjectMapper objectMapper,
      final JsonNode state,
      final JsonNode input) {
    try {
      String fork = state.get("fork").asText();
      Long chainId = Long.valueOf(state.get("chainid").asText());
      String reward = state.get("reward").asText();

      ReferenceTestEnv referenceTestEnv =
          objectMapper.convertValue(input.get("env"), ReferenceTestEnv.class);
      Map<String, ReferenceTestWorldState.AccountMock> accounts =
          objectMapper.convertValue(input.get("alloc"), new TypeReference<>() {});

      final T8nExecutor.T8nResult result;
      try (ReferenceTestWorldState initialWorldState =
          ReferenceTestWorldState.create(accounts, EvmConfiguration.DEFAULT)) {
        initialWorldState.persist(null);
        List<Transaction> transactions = new ArrayList<>();
        List<RejectedTransaction> rejections = new ArrayList<>();
        JsonNode txs = input.get("txs");
        if (txs != null) {
          if (txs instanceof ArrayNode txsArray) {
            extractTransactions(
                new PrintWriter(System.err, true, StandardCharsets.UTF_8),
                txsArray.elements(),
                transactions,
                rejections);
          } else if (txs instanceof TextNode txt) {
            transactions =
                extractTransactions(
                    new PrintWriter(System.err, true, StandardCharsets.UTF_8),
                    List.<JsonNode>of(txt).iterator(),
                    transactions,
                    rejections);
          }
        }

        T8nExecutor.TracerManager tracerManager;
        if (parentCommand.showJsonResults) {
          tracerManager =
              new T8nExecutor.TracerManager() {
                private final Map<OperationTracer, FileOutputStream> outputStreams =
                    new HashMap<>();

                @Override
                public OperationTracer getManagedTracer(final int txIndex, final Hash txHash)
                    throws Exception {
                  outDir.toFile().mkdirs();
                  var traceDest =
                      new FileOutputStream(
                          outDir
                              .resolve(
                                  String.format("trace-%d-%s.jsonl", txIndex, txHash.toHexString()))
                              .toFile());

                  var jsonTracer =
                      new StandardJsonTracer(
                          new PrintStream(traceDest),
                          parentCommand.showMemory,
                          !parentCommand.hideStack,
                          parentCommand.showReturnData,
                          parentCommand.showStorage,
                          parentCommand.eip3155strict);
                  outputStreams.put(jsonTracer, traceDest);
                  return jsonTracer;
                }

                @Override
                public void disposeTracer(final OperationTracer tracer) throws IOException {
                  if (outputStreams.containsKey(tracer)) {
                    outputStreams.remove(tracer).close();
                  }
                }
              };
        } else {
          tracerManager =
              new T8nExecutor.TracerManager() {
                @Override
                public OperationTracer getManagedTracer(final int txIndex, final Hash txHash) {
                  return OperationTracer.NO_TRACING;
                }

                @Override
                public void disposeTracer(final OperationTracer tracer) {
                  // single-test mode doesn't need to track tracers
                }
              };
        }

        result =
            T8nExecutor.runTest(
                chainId,
                fork,
                reward,
                objectMapper,
                referenceTestEnv,
                initialWorldState,
                transactions,
                rejections,
                tracerManager);
      }

      ObjectNode outputObject = objectMapper.createObjectNode();
      outputObject.set("alloc", result.allocObject());
      outputObject.set("body", result.bodyBytes());
      outputObject.set("result", result.resultObject());

      String response =
          objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(outputObject);
      req.response().setChunked(true);
      req.response().putHeader("Content-Type", "application/json").send(response);
    } catch (Exception t) {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      PrintStream ps = new PrintStream(baos, true, StandardCharsets.UTF_8);
      t.printStackTrace(ps);
      ObjectNode json = objectMapper.createObjectNode();
      json.put("error", t.getMessage());
      json.put("stacktrace", baos.toString(StandardCharsets.UTF_8).replaceAll("\\s", " "));

      t.printStackTrace(System.out);

      req.response().setStatusCode(500).end(json.toString());
    }
  }
Default constructor for the T8nServerSubCommand class. This constructor is required by PicoCLI
and assigns null to parentCommand.
ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nServerSubCommand.java