@Override
  public void handleRequest(Transaction transaction, Request<JsonObject> request) throws Exception {

    if (demoBean == null) {
      throw new RuntimeException("Not autowired dependencies");
    }
    log.debug("Request id:" + request.getId());
    log.debug("Request method:" + request.getMethod());
    log.debug("Request params:" + request.getParams());

    transaction.sendResponse(request.getParams());
  }
  @Test
  public void requestTest() {

    Params params = new Params();
    params.param1 = "Value1";
    params.param2 = "Value2";
    params.data = new Data();
    params.data.data1 = "XX";
    params.data.data2 = "YY";

    Request<Params> request = new Request<Params>(1, "method", params);

    String requestJson = JsonUtils.toJsonRequest(request);

    log.info(requestJson);

    Request<Params> newRequest = JsonUtils.fromJsonRequest(requestJson, Params.class);

    Assert.assertEquals(params.param1, newRequest.getParams().param1);
    Assert.assertEquals(params.param2, newRequest.getParams().param2);
    Assert.assertEquals(params.data.data1, newRequest.getParams().data.data1);
    Assert.assertEquals(params.data.data2, newRequest.getParams().data.data2);
  }
  @Test
  public void requestTest() {

    Params params = new Params();
    params.param1 = "Value1";

    Request<Params> request = new Request<Params>(1, "method", params);
    request.setSessionId("xxxxxxx");

    String requestJson = request.toString();
    Assert.assertEquals(
        "{\"id\":1,\"method\":\"method\",\"params\":{\"param1\":\"Value1\",\"sessionId\":\"xxxxxxx\"},\"jsonrpc\":\"2.0\"}",
        requestJson);

    log.info(requestJson);

    Request<Params> newRequest = JsonUtils.fromJsonRequest(requestJson, Params.class);

    Assert.assertEquals(params.param1, newRequest.getParams().param1);
    Assert.assertEquals(newRequest.getSessionId(), "xxxxxxx");
  }