@Test
  public void testInvalidateSession10() throws Exception {
    Callback c_1 = (request, response) -> {
      HttpSession s = request.getSession();
      s.invalidate();
      PrintWriter out = response.getWriter();
      try {
        s.removeAttribute("foo");
      } catch (IllegalStateException iex) {
        out.write("OK");
      }
    };

    tester.setAttribute("callback_1", c_1);

    servletHolder.setInitParameter("test.callback", "callback_1");

    tester.start();

    request.setMethod("GET");
    request.setURI("/test/hello");
    request.setHeader("Host", "tester");
    request.setVersion("HTTP/1.0");
    response = HttpTester.parseResponse(tester.getResponses(request.generate()));

    assertEquals("OK", response.getContent());
  }
Test that invalidating a session throws an exception on subsequent access.
extensions/geode-modules-session/src/integrationTest/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java