ClientRMProxy extends RMProxy<T> { @Unstable public static Text getRMDelegationTokenService(Configuration conf) { return getTokenService(conf, YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT); } private  ClientRMProxy(); static T createRMProxy(final Configuration configuration,
      final Class<T> protocol); @Private @Override InetSocketAddress getRMAddress(YarnConfiguration conf,
      Class<?> protocol); @Private @Override void checkAllowedProtocols(Class<?> 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 testGetRMDelegationTokenService() { String defaultRMAddress = YarnConfiguration.DEFAULT_RM_ADDRESS; YarnConfiguration conf = new YarnConfiguration(); Text tokenService = ClientRMProxy.getRMDelegationTokenService(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.getRMDelegationTokenService(conf); services = tokenService.toString().split(","); assertEquals(2, services.length); for (String service : services) { assertTrue("Incorrect token service name", service.contains(defaultRMAddress)); } }