@Test
  public void testCallback() throws Exception {
    final String helloWorld = "Hello World";
    Callback c = (request, response) -> {
      PrintWriter out = response.getWriter();
      out.write(helloWorld);
    };
    servlet.getServletContext().setAttribute("callback", c);

    WebConversation wc = new WebConversation();
    WebRequest req = new GetMethodWebRequest(String.format("http://localhost:%d/test", port));
    req.setParameter("cmd", QueryCommand.CALLBACK.name());
    req.setParameter("param", "callback");

    WebResponse response = wc.getResponse(req);
    assertThat(response.getText()).isEqualTo(helloWorld);
  }
Test callback functionality. This is here really just as an example. Callbacks are useful to
implement per test actions which can be defined within the actual test method instead of in a
separate servlet class.
extensions/geode-modules-tomcat8/src/distributedTest/java/org/apache/geode/modules/session/TestSessionsTomcat8Base.java