@Test
  public void TestActiveMaster() throws Exception {
    HBaseRpcController rpcController = getRpcController();
    ServerName activeMaster = TEST_UTIL.getMiniHBaseCluster().getMaster().getServerName();
    int rpcCount = 0;
    for (JVMClusterUtil.MasterThread masterThread : TEST_UTIL.getMiniHBaseCluster()
      .getMasterThreads()) {
      ClientMetaService.BlockingInterface stub =
        getMasterStub(masterThread.getMaster().getServerName());
      GetActiveMasterResponse resp =
        stub.getActiveMaster(rpcController, GetActiveMasterRequest.getDefaultInstance());
      assertEquals(activeMaster, ProtobufUtil.toServerName(resp.getServerName()));
      rpcCount++;
    }
    assertEquals(MASTER_COUNT, rpcCount);
  }
Verifies the active master ServerName as seen by all masters.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClientMetaServiceRPCs.java