@Test
  public void testExceptionThrownWhenMisConfigured() throws IOException {
    Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
    conf.set("hbase.thrift.security.qop", "privacy");
    conf.setBoolean("hbase.thrift.ssl.enabled", false);
    ExpectedException thrown = ExpectedException.none();
    ThriftServerRunner tsr = null;
    try {
      thrown.expect(IllegalArgumentException.class);
      thrown.expectMessage(
        "Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false");
      tsr = TestThriftServerCmdLine.createBoundServer(() -> new ThriftServer(conf));
      fail("Thrift HTTP Server starts up even with wrong security configurations.");
    } catch (Exception e) {
      LOG.info("Expected!", e);
    } finally {
      if (tsr != null) {
        tsr.close();
      }
    }
  }
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