code: private Optional<String> getXsrfFromHtmlBody(HttpResponse loginResponse) throws IOException {
          Optional<Cookie> gerritAccountCookie = findGerritAccountCookie();
          if (gerritAccountCookie.isPresent()) {
              Matcher matcher = GERRIT_AUTH_PATTERN.matcher(EntityUtils.toString(loginResponse.getEntity(), Consts.UTF_8));
              if (matcher.find()) {
                  return Optional.of(matcher.group(1));
              }
          }
          return Optional.absent();
      }
docs: In Gerrit < 2.12 the XSRF token was included in the start page HTML.