protected static void doLogin() throws Exception {
    System.out
        .println("BaseServiceTest ::  Executing doLogin with user : admin, password : admin.");

    CloseableHttpResponse loginResponse = null;
    try {
      BasicCookieStore cookieStore = new BasicCookieStore();
      httpclient = HttpClients.custom().setDefaultCookieStore(cookieStore).build();
      HttpUriRequest login = RequestBuilder.post().setUri(new URI(LOGIN_URL))
          .addParameter("j_username", "admin").addParameter("j_password", "admin").build();
      loginResponse = httpclient.execute(login);
      try {
        HttpEntity entity = loginResponse.getEntity();
        EntityUtils.consume(entity);
        System.out
            .println("BaseServiceTest :: HTTP request status : " + loginResponse.getStatusLine());

        List<Cookie> cookies = cookieStore.getCookies();
        if (cookies.isEmpty()) {
        } else {
          for (int i = 0; i < cookies.size(); i++) {
          }
        }
      } finally {
        if (loginResponse != null) {
          loginResponse.close();
        }
      }
    } catch (Exception failed) {
      logException(failed);
      throw failed;
    }

    System.out.println("BaseServiceTest ::  Executed doLogin");
  }
Login to pulse server and setup httpClient for tests To be called from setupBeforeClass in each
test class
geode-pulse/src/uiTest/java/org/apache/geode/tools/pulse/tests/junit/BaseServiceTest.java