@Test
public void shouldConnectToFirstUrlWhenMultipleRMUrlIsConfiguredInCustomConfig() throws IOException {

  Map<String, String> map = new HashMap<>();
  map.put("yarn.resourcemanager.url", HTTP_RM_URL1 + ", " + HTTP_RM_URL2);
  ViewContext viewContext = getViewContext(map);
  AmbariApi ambariApi = createNiceMock(AmbariApi.class);
  URLStreamProvider urlStreamProvider = createNiceMock(URLStreamProvider.class);
  InputStream inputStream = IOUtils.toInputStream("{\"clusterInfo\": {\"haState\": \"ACTIVE\"}}");
  expect(ambariApi.isClusterAssociated()).andReturn(false);
  expect(viewContext.getURLStreamProvider()).andReturn(urlStreamProvider);
  expect(urlStreamProvider.readFrom(eq(HTTP_RM_URL1 + RM_INFO_API_ENDPOINT), eq("GET"), anyString(), EasyMock.<Map<String, String>>anyObject())).andReturn(inputStream);
  replayAll();
  Services services = new Services(ambariApi, viewContext);
  assertEquals(HTTP_RM_URL1, services.getRMUrl());
}