Package org.serviceconnector.api.cln

Examples of org.serviceconnector.api.cln.SCClient


    int sum = 0;
    for (int i = 0; i < messages.length; i++) {
      sum += messages[i].value();
    }
    try {
      SCClient sc = new SCClient(TestConstants.HOST, TestConstants.PORT_SC0_HTTP);
      sc.attach();
      SCSessionService service = sc.newSessionService(TestConstants.sesServiceName1);
      SCMessage scMessage = new SCMessage();
      scMessage.setSessionInfo("sessionInfo");
      service.createSession(300, scMessage, new TestSessionServiceMessageCallback(service));
      response = service.execute(new SCMessage("executed"));
      service.deleteSession();
      sc.detach();
    } catch (Exception e) {
    }

    testLogger.info("Messages executed successfuly (clients):\t" + sum);
    testLogger.info("Messages executed successfuly (server):\t" + response.getData().toString());
View Full Code Here


    this.messageSize = messageSize;
  }

  @Override
  public void run() {
    SCClient sc = new SCClient(TestConstants.HOST, TestConstants.PORT_SC0_TCP, ConnectionType.NETTY_TCP);
    long start = System.currentTimeMillis();
    try {
      // wait for signal to start cycle
      beforeAttachSignal.await();
      try {
        sc.attach();
      } catch (Exception e) {
        testLogger.info("attach failed");
      } finally {
        attachedSignal.countDown();
      }

      afterAttachSignal.await();

      for (int i = 0; i < sessionCycles; i++) {
        SCSessionService service = sc.newSessionService(TestConstants.sesServiceName1);
        SCMessage scMessage = new SCMessage();
        scMessage.setSessionInfo("sessionInfo");
        service.createSession(300, scMessage, new TestSessionServiceMessageCallback(service));
        for (int j = 0; j < executeCycles; j++) {
          service.execute(new SCMessage(new byte[messageSize]));
          counter.increment();
        }
        service.deleteSession();
      }

    } catch (Exception e) {
      LOGGER.fatal("run", e);
    } finally {
      try {
        sc.detach();
      } catch (Exception e) {
        testLogger.info("detach failed");
      }
      long stop = System.currentTimeMillis();
      // signal that this worker is done
View Full Code Here

TOP

Related Classes of org.serviceconnector.api.cln.SCClient

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.