Package com.kurento.kmf.thrift.jsonrpcconnector

Examples of com.kurento.kmf.thrift.jsonrpcconnector.JsonRpcServerThrift


    return new JsonRpcClientThrift("127.0.0.1", 6463, "127.0.0.1", 7979);
  }

  @Override
  protected void startJsonRpcServer(RomServerJsonRpcHandler jsonRpcHandler) {
    server = new JsonRpcServerThrift(jsonRpcHandler, "127.0.0.1", 6463);
    server.start();
  }
View Full Code Here


  @Test
  public void test() throws TException, IOException {

    log.info("Starting server");
    JsonRpcServerThrift server = new JsonRpcServerThrift(
        new EchoJsonRpcHandler(), "127.0.0.1", 19292);

    server.start();
    log.info("Server started");

    log.info("Starting client");

    JsonRpcClient client = new JsonRpcClientThrift("127.0.0.1", 19292,
        "127.0.0.1", 7979);

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

    Params result = client.sendRequest("echo", params, Params.class);

    log.info("Response:" + result);

    Assert.assertEquals(params.param1, result.param1);
    Assert.assertEquals(params.param2, result.param2);

    client.close();

    log.info("Client finished");

    server.destroy();

    log.info("Server finished");

  }
View Full Code Here

  private static JsonRpcServerThrift server;

  @BeforeClass
  public static void start() throws Exception {

    server = new JsonRpcServerThrift(new EchoJsonRpcHandler(), LOCALHOST,
        THRIFT_SERVER_PORT);

    server.start();
  }
View Full Code Here

    System.setProperty(KeepAliveManager.KEEP_ALIVE_INTERVAL_TIME_PROPERTY,
        "1000");

    log.info("Starting server");
    JsonRpcServerThrift server = new JsonRpcServerThrift(
        new EchoJsonRpcHandler(), "127.0.0.1", 19292);

    server.start();
    log.info("Server started");

    long initTime = System.nanoTime();

    log.info("Starting client");
    JsonRpcClient client = new JsonRpcClientThrift("127.0.0.1", 19292,
        "127.0.0.1", 7979);

    if (!latch.await(15, TimeUnit.SECONDS)) {
      Assert.fail("Timeout of 15s waiting for keepAlives");
    } else {
      long duration = ((System.nanoTime() - initTime) / 1000000);

      Assert.assertTrue(
          "Waiting time should be greather than estimated keepAlive time ("
              + duration + " > " + (NUM_KEEP_ALIVES * 1000) + ")",
          duration > NUM_KEEP_ALIVES * 1000);

      Assert.assertTrue("Waiting time should be a bit more than "
          + NUM_KEEP_ALIVES + " keepAlive times (" + duration + " < "
          + ((NUM_KEEP_ALIVES + 3) * 1000) + ")",
          duration < (NUM_KEEP_ALIVES + 3) * 1000);

    }

    client.close();

    log.info("Client finished");

    server.destroy();

    log.info("Server finished");

  }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.thrift.jsonrpcconnector.JsonRpcServerThrift

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.