public void startThriftServer(Configuration conf, ThriftServerType type) throws Exception {
    List<String> args = new ArrayList<>();
    port = HBaseTestingUtil.randomFreePort();
    args.add("-" + Constants.PORT_OPTION);
    args.add(String.valueOf(port));
    args.add("-" + INFOPORT_OPTION);
    int infoPort = HBaseTestingUtil.randomFreePort();
    args.add(String.valueOf(infoPort));

    LOG.info("Starting Thrift Server {} on port: {} ", type, port);
    thriftServer = createThriftServer(conf, type);
    startThriftServerThread(args.toArray(new String[args.size()]));
    // wait up to 10s for the server to start
    waitForThriftServer();
    LOG.info("Started Thrift Server {} on port {}", type, port);
  }
start thrift server
@param conf configuration
@param type the type of thrift server
@throws Exception When starting the thrift server fails.
hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/HBaseThriftTestingUtility.java