@Test
  public void testAdminTimeout() throws Exception {
    try (Connection conn = createConnection(); Admin admin = conn.getAdmin()) {
      int initialInvocations = invokations.get();
      boolean balanceEnabled = admin.isBalancerEnabled();
      for (int i = 0; i < 5; i++) {
        assertEquals(balanceEnabled, admin.balancerSwitch(!balanceEnabled, false));
        balanceEnabled = !balanceEnabled;
      }
      // Ensure the RandomTimeoutRpcEngine is actually being used.
      assertTrue(invokations.get() > initialInvocations);
    }
  }
Test that a client that fails an RPC to the master retries properly and doesn't throw any
unexpected exceptions.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientTimeouts.java