@Test
  public void testRunThriftServerWithHeaderBufferLength() throws Exception {
    // Test thrift server with HTTP header length less than 64k
    try {
      runThriftServer(1024 * 63);
    } catch (TTransportException tex) {
      assertFalse(tex.getMessage().equals("HTTP Response code: 431"));
    }

    // Test thrift server with HTTP header length more than 64k, expect an exception
    exception.expect(TTransportException.class);
    exception.expectMessage("HTTP Response code: 431");
    runThriftServer(1024 * 64);
  }
Start the HBase Thrift HTTP server on a random port through the command-line interface and talk
to it from client side.
hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java