### Question:
ClientRMProxy extends RMProxy<T> { @InterfaceStability.Unstable public static Text getRMDelegationTokenService(Configuration conf) { if (HAUtil.isHAEnabled(conf)) { ArrayList<String> services = new ArrayList<String>(); YarnConfiguration yarnConf = new YarnConfiguration(conf); for (String rmId : HAUtil.getRMHAIds(conf)) { yarnConf.set(YarnConfiguration.RM_HA_ID, rmId); services.add(SecurityUtil.buildTokenService( yarnConf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT)).toString()); } return new Text(Joiner.on(',').join(services)); } return SecurityUtil.buildTokenService( conf.getSocketAddr(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, YarnConfiguration.DEFAULT_RM_PORT)); } private  ClientRMProxy(); static T createRMProxy(final Configuration configuration,
      final Class<T> protocol); @InterfaceStability.Unstable static Text getRMDelegationTokenService(Configuration conf);  }### Answer:
@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)); } }