@Test
  public void testInvalidateAndRecreateSession() throws Exception {
    Callback c_1 = (request, response) -> {

      PrintWriter out = response.getWriter();
      out.write(request.getSession().getId());
    };

    Callback c_2 = (request, response) -> {
      HttpSession s = request.getSession();
      s.invalidate();

      PrintWriter out = response.getWriter();
      out.write(request.getSession().getId());
    };

    tester.setAttribute("callback_1", c_1);
    tester.setAttribute("callback_2", c_2);

    ServletHolder sh = tester.addServlet(BasicServlet.class, "/dispatch");
    sh.setInitParameter("test.callback", "callback_2");

    tester.start();
    // ContextManager.getInstance().putContext(
    // sh.getServlet().getServletConfig().getServletContext());

    request.setMethod("GET");
    request.setURI("/test/hello");
    request.setHeader("Host", "tester");
    request.setVersion("HTTP/1.0");

    response = HttpTester.parseResponse(tester.getResponses(request.generate()));
    String session1 = response.getContent();

    request.setHeader("Cookie", "JSESSIONID=" + session1);
    request.setURI("/test/request2");
    response = HttpTester.parseResponse(tester.getResponses(request.generate()));

    String session12 = response.getContent();
    assertFalse("First and subsequent session ids must not be the same",
        session1.equals(session12));
  }
Test that we can invalidate and then recreate a new session
extensions/geode-modules-session/src/integrationTest/java/org/apache/geode/modules/session/internal/filter/SessionReplicationIntegrationJUnitTest.java