@Test
  public void testLastAccessedTime() throws Exception {
    final Callback c = (request, response) -> {
      final HttpSession session = request.getSession();
      // Hack to expose the session to our test context
      session.getServletContext().setAttribute("session", session);
      session.setAttribute("lastAccessTime", session.getLastAccessedTime());
      try {
        Thread.sleep(100);
      } catch (final InterruptedException ex) {
        // Ignore.
      }
      session.setAttribute("somethingElse", 1);
      request.getSession();
      response.getWriter().write("done");
    };
    servlet.getServletContext().setAttribute("callback", c);

    final WebConversation wc = new WebConversation();
    final WebRequest req = new GetMethodWebRequest(String.format("http://localhost:%d/test", port));

    // Execute the callback
    req.setParameter("cmd", QueryCommand.CALLBACK.name());
    req.setParameter("param", "callback");
    wc.getResponse(req);

    final HttpSession session = (HttpSession) servlet.getServletContext().getAttribute("session");
    final Long lastAccess = (Long) session.getAttribute("lastAccessTime");

    assertTrue(
        "Last access time not set correctly: " + lastAccess + " not <= "
            + session.getLastAccessedTime(),
        lastAccess <= session.getLastAccessedTime());
  }
Test setting the session expiration via a property change as would happen under normal
deployment conditions.
extensions/geode-modules-test/src/main/java/org/apache/geode/modules/session/AbstractSessionsTest.java