@Test
  public void testCountController() throws Exception {
    Configuration conf = new Configuration(UTIL.getConfiguration());
    // setup our custom controller
    conf.set(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY,
      StaticRpcControllerFactory.class.getName());

    final TableName tableName = TableName.valueOf(name.getMethodName());
    UTIL.createTable(tableName, fam1).close();

    // change one of the connection properties so we get a new Connection with our configuration
    conf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, HConstants.DEFAULT_HBASE_RPC_TIMEOUT + 1);

    try (Connection connection = ConnectionFactory.createConnection(conf);
      Table table = connection.getTable(tableName)) {
      byte[] row = Bytes.toBytes("row");
      Put p = new Put(row);
      p.addColumn(fam1, fam1, Bytes.toBytes("val0"));
      table.put(p);

      Integer counter = 1;
      counter = verifyCount(counter);

      Delete d = new Delete(row);
      d.addColumn(fam1, fam1);
      table.delete(d);
      counter = verifyCount(counter);

      Put p2 = new Put(row);
      p2.addColumn(fam1, Bytes.toBytes("qual"), Bytes.toBytes("val1"));
      table.batch(Lists.newArrayList(p, p2), null);
      // this only goes to a single server, so we don't need to change the count here
      counter = verifyCount(counter);

      Append append = new Append(row);
      append.addColumn(fam1, fam1, Bytes.toBytes("val2"));
      table.append(append);
      counter = verifyCount(counter);

      // and check the major lookup calls as well
      Get g = new Get(row);
      table.get(g);
      counter = verifyCount(counter);

      ResultScanner scan = table.getScanner(fam1);
      scan.next();
      scan.close();
      counter = verifyCount(counter + 1);

      Get g2 = new Get(row);
      table.get(Lists.newArrayList(g, g2));
      // same server, so same as above for not changing count
      counter = verifyCount(counter);

      // make sure all the scanner types are covered
      Scan scanInfo = new Scan().withStartRow(row);
      // regular small
      scanInfo.setReadType(ReadType.PREAD);
      counter = doScan(table, scanInfo, counter);

      // reversed, small
      scanInfo.setReversed(true);
      counter = doScan(table, scanInfo, counter);

      // reversed, regular
      scanInfo.setReadType(ReadType.STREAM);
      doScan(table, scanInfo, counter + 1);

      // make sure we have no priority count
      verifyPriorityGroupCount(HConstants.ADMIN_QOS, 0);
      // lets set a custom priority on a get
      Get get = new Get(row);
      get.setPriority(HConstants.ADMIN_QOS);
      table.get(get);
      // we will reset the controller for setting the call timeout so it will lead to an extra
      // setPriority
      verifyPriorityGroupCount(HConstants.ADMIN_QOS, 2);
    }
  }
check some of the methods and make sure we are incrementing each time. Its a bit tediuous to
cover all methods here and really is a bit brittle since we can always add new methods but
won't be sure to add them here. So we just can cover the major ones.
@throws Exception on failure
hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java