ClientRMProxy extends RMProxy<T> { @Unstable public static Text getAMRMTokenService(Configuration conf) { return getTokenService(conf, YarnConfiguration.RM_SCHEDULER_ADDRESS, YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS, YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT); } private  ClientRMProxy(); static T createRMProxy(final Configuration configuration,
      final Class<T> protocol); @Unstable static Text getRMDelegationTokenService(Configuration conf); @Unstable static Text getAMRMTokenService(Configuration conf); @Unstable static Text getTokenService(Configuration conf, String address,
      String defaultAddr, int defaultPort);  }
@Test public void testGetAMRMTokenService() { String defaultRMAddress = YarnConfiguration.DEFAULT_RM_SCHEDULER_ADDRESS; YarnConfiguration conf = new YarnConfiguration(); Text tokenService = ClientRMProxy.getAMRMTokenService(conf); String[] services = tokenService.toString().split(","); assertEquals(1, services.length); for (String service : services) { assertTrue("Incorrect token service name", service.contains(defaultRMAddress)); } conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, true); conf.set(YarnConfiguration.RM_HA_IDS, "rm1,rm2"); conf.set(HAUtil.addSuffix(YarnConfiguration.RM_HOSTNAME, "rm1"), "0.0.0.0"); conf.set(HAUtil.addSuffix(YarnConfiguration.RM_HOSTNAME, "rm2"), "0.0.0.0"); tokenService = ClientRMProxy.getAMRMTokenService(conf); services = tokenService.toString().split(","); assertEquals(2, services.length); for (String service : services) { assertTrue("Incorrect token service name", service.contains(defaultRMAddress)); } }