@Test
  public void TestMetaLocations() throws Exception {
    HBaseRpcController rpcController = getRpcController();
    List<HRegionLocation> metaLocations =
      TEST_UTIL.getMiniHBaseCluster().getMaster().getMetaLocations();
    Collections.sort(metaLocations);
    int rpcCount = 0;
    for (JVMClusterUtil.MasterThread masterThread : TEST_UTIL.getMiniHBaseCluster()
      .getMasterThreads()) {
      ClientMetaService.BlockingInterface stub =
        getMasterStub(masterThread.getMaster().getServerName());
      GetMetaRegionLocationsResponse resp = stub.getMetaRegionLocations(rpcController,
        GetMetaRegionLocationsRequest.getDefaultInstance());
      List<HRegionLocation> result = new ArrayList<>();
      resp.getMetaLocationsList()
        .forEach(location -> result.add(ProtobufUtil.toRegionLocation(location)));
      Collections.sort(result);
      assertEquals(metaLocations, result);
      rpcCount++;
    }
    assertEquals(MASTER_COUNT, rpcCount);
  }
Verifies that the meta region locations RPC returns consistent results across all masters.
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClientMetaServiceRPCs.java