@Test
  public void testRegionInvalidate() throws Exception {
    final String key = "value_testRegionInvalidate";
    final String value = "Foo";

    final WebConversation wc = new WebConversation();
    final WebRequest req = prepareRequest(key, value);
    final WebResponse response = wc.getResponse(req);
    final String sessionId = response.getNewCookieValue("JSESSIONID");

    // Invalidate the session
    req.removeParameter("param");
    req.removeParameter("value");
    req.setParameter("cmd", QueryCommand.INVALIDATE.name());
    wc.getResponse(req);

    assertNull("The region should not have an entry for this session", region.get(sessionId));
  }
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