private void ensureServersWithSamePort(HMaster master, int[] rsPorts) {
    // Make sure live regionservers are on the same host/port
    List<ServerName> localServers = master.getServerManager().getOnlineServersList();
    assertEquals(NUM_OF_RS, localServers.size());
    for (int i = 0; i < NUM_OF_RS; i++) {
      boolean found = false;
      for (ServerName serverName : localServers) {
        if (serverName.getPort() == rsPorts[i]) {
          found = true;
          break;
        }
      }
      assertTrue(found);
    }
  }
This tests the force retaining assignments upon an RS restart, even when master triggers an SCP
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRetainAssignmentOnRestart.java