private static String readFully(final InputStream input) throws IOException {
    // TODO: when the time comes, delete me and replace with a JDK11 IO helper API.
    try (final BufferedReader reader =
      new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) {
      final StringBuilder sb = new StringBuilder();
      final CharBuffer buffer = CharBuffer.allocate(1024 * 2);
      while (reader.read(buffer) > 0) {
        sb.append(buffer);
        buffer.clear();
      }
      return sb.toString();
    } finally {
      input.close();
    }
  }
Test that verifies headers can be up to 64K long. The test adds a 63K header leaving 1K for
other headers. This is because the header buffer setting is for ALL headers, names and values
included.
hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpServer.java