@Test
  public void testSessionExpirationByContainer() throws Exception {

    final String key = "value_testSessionExpiration1";
    final String value = "Foo";

    final WebConversation wc = new WebConversation();
    final WebRequest req = prepareRequest(key, value);
    wc.getResponse(req);

    // Set the session timeout of this one session.
    req.setParameter("cmd", QueryCommand.SET_MAX_INACTIVE.name());
    req.setParameter("value", "1");
    wc.getResponse(req);

    // Wait until the session should expire
    Thread.sleep(2000);

    // Do a request, which should cause the session to be expired
    req.setParameter("cmd", QueryCommand.GET.name());
    req.setParameter("param", key);
    final WebResponse response = wc.getResponse(req);

    assertEquals("", response.getText());
  }
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