Package com.kurento.kmf.jsonrpcconnector

Examples of com.kurento.kmf.jsonrpcconnector.KeepAliveManager


    server = new ThriftServer(clientProcessor, executorService,
        localHandlerAddress);

    server.start();

    keepAliveManager = new KeepAliveManager(this,
        KeepAliveManager.Mode.PER_CLIENT);

    keepAliveManager.start();
  }
View Full Code Here


    if (client instanceof JsonRpcClientThrift) {
      client.getKeepAliveManager().stop();
      client.setKeepAliveManager(null);

      keepAliveManager = new KeepAliveManager(client,
          KeepAliveManager.Mode.PER_ID_AS_SESSION);

      keepAliveManager.start();
    }
  }
View Full Code Here

          Continuation<Response<JsonElement>> continuation) {
        internalSendRequestBroker(request, resultClass, continuation);
      }
    };

    keepAliveManager = new KeepAliveManager(this,
        KeepAliveManager.Mode.PER_ID_AS_MEDIAPIPELINE);

    keepAliveManager.start();
  }
View Full Code Here

  @Test
  public void oneSessionTest() throws InterruptedException {

    JsonRpcClientKeepAliveController controller = new JsonRpcClientKeepAliveController();

    KeepAliveManager keepAliveManager = new KeepAliveManager(
        controller.getClient(), KEEPALIVE_INTERVAL_TIME,
        KeepAliveManager.Mode.PER_CLIENT);

    keepAliveManager.start();

    long duration = controller.waitForEvents(3);

    Assert.assertTrue(duration + MARGIN_TIME > KEEPALIVE_INTERVAL_TIME
        * NUM_KEEP_ALIVES);

    keepAliveManager.stop();
  }
 
View Full Code Here

  @Test
  public void oneMediaPipelineTest() throws InterruptedException {

    JsonRpcClientKeepAliveController controller = new JsonRpcClientKeepAliveController();

    KeepAliveManager keepAliveManager = new KeepAliveManager(
        controller.getClient(), KEEPALIVE_INTERVAL_TIME,
        KeepAliveManager.Mode.PER_ID_AS_SESSION);

    keepAliveManager.start();

    Thread.sleep(KEEPALIVE_INTERVAL_TIME * 2);

    Assert.assertTrue(
        "KeepAliveManager in pipeline mode without pipelines shouldn't send any keepAlive event",
        controller.clearEvents() == 0);

    keepAliveManager.addId("XXXXX");

    Thread.sleep(KEEPALIVE_INTERVAL_TIME * 3);

    Assert.assertTrue("keepAlive events should be at least 2",
        controller.clearEvents() >= 2);

    keepAliveManager.stop();
  }
View Full Code Here

  @Test
  public void addRemovePipelinesTest() throws InterruptedException {

    JsonRpcClientKeepAliveController controller = new JsonRpcClientKeepAliveController();

    KeepAliveManager keepAliveManager = new KeepAliveManager(
        controller.getClient(), KEEPALIVE_INTERVAL_TIME,
        KeepAliveManager.Mode.PER_ID_AS_SESSION);

    keepAliveManager.start();

    String mediaPipelineIdA = "XXXXX";
    String mediaPipelineIdB = "YYYYY";

    keepAliveManager.addId(mediaPipelineIdA);
    keepAliveManager.addId(mediaPipelineIdB);

    Thread.sleep(KEEPALIVE_INTERVAL_TIME * 3);

    Assert.assertTrue("keepAlive events should be at least 2 x 2 = 4",
        controller.clearEvents() >= 4);

    keepAliveManager.removeId(mediaPipelineIdA);
    keepAliveManager.removeId(mediaPipelineIdB);

    Thread.sleep(KEEPALIVE_INTERVAL_TIME);
    log.info("Removed media pipelines and wait a keepAliveIntervalTime");

    controller.clearEvents();
    log.info("Cleared events after removing media pipelines");

    Thread.sleep(KEEPALIVE_INTERVAL_TIME * 3);

    Assert.assertTrue(
        "keepAliveManager without pipelines shouldn't send keepAlives",
        controller.clearEvents() == 0);

    keepAliveManager.stop();
  }
View Full Code Here

TOP

Related Classes of com.kurento.kmf.jsonrpcconnector.KeepAliveManager

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.