Beispiel #1
0
  @Test
  public void testRespond() {

    System.out.println("/b".split("/").length);

    // Client Side /////////////////////////////////////////////////////////

    // create new request with own response handler
    Request request =
        new GETRequest() {
          @Override
          protected void handleResponse(Response response) {
            // change state of outer object
            handledResponse = response;
          }
        };

    /* (...) send the request to server */

    // Server Side /////////////////////////////////////////////////////////

    /* (...) receive request from client */

    // create new response
    Response response = new Response();

    // respond to the request
    request.respond(response);

    // Validation  /////////////////////////////////////////////////////////

    // check if response was handled correctly
    assertSame(response, handledResponse);
  }