void runThriftServer(int customHeaderSize) throws Exception {
    // Add retries in case we see stuff like connection reset
    Exception clientSideException = null;
    for (int i = 0; i < 10; i++) {
      clientSideException = null;
      ThriftServerRunner tsr = createBoundServer(getThriftServerSupplier());
      String url = "http://" + HConstants.LOCALHOST + ":" + tsr.getThriftServer().listenPort;
      try {
        checkHttpMethods(url);
        talkToThriftServer(url, customHeaderSize);
        break;
      } catch (Exception ex) {
        clientSideException = ex;
        LOG.info("Client-side Exception", ex);
      } finally {
        tsr.close();
        tsr.join();
        if (tsr.getRunException() != null) {
          LOG.error("Invocation of HBase Thrift server threw exception", tsr.getRunException());
          throw tsr.getRunException();
        }
      }
    }

    if (clientSideException != null) {
      LOG.error("Thrift Client", clientSideException);
      throw clientSideException;
    }
  }
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