Package org.serviceconnector.api.srv

Examples of org.serviceconnector.api.srv.SCServer


  public void run() {

    List<String> nics = new ArrayList<String>();
    nics.add("localhost");

    SCServer sc = new SCServer("localhost", 9000, nics, 9001, ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE);

    try {
      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "publish-1";
      SCPublishServer publishSrv = sc.newPublishServer(serviceName);
      try {

        int maxSessions = 10;
        int maxConnections = 5;
        SCPublishServerCallback cbk = new SrvCallback(publishSrv);

        publishSrv.register(maxSessions, maxConnections, cbk);
      } catch (Exception e) {
        publishSrv.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runPublishServer", e);
      sc.stopListener();
      sc.destroy();
    }
  }
View Full Code Here


        this.scPublishServer.deregister();
        ;
      } catch (Exception e) {
        LOGGER.error("run", e);
      } finally {
        SCServer sc = this.scPublishServer.getSCServer();
        sc.stopListener();
        sc.destroy();
      }
    }
View Full Code Here

   * Description:  publish 100000 compressed messages � 128 bytes to the server.<br>
   * Expectation:  passes
   */
  @Test
  public void publish_100000_msg_compressed() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_PUB_SRV_TCP, ConnectionType.NETTY_TCP);
    server.startListener();
    publishServer = server.newPublishServer(TestConstants.pubServiceName1);
    SCPublishServerCallback cbk = new PubSrvCallback(publishServer);
    publishServer.register(10, 2, cbk);
    SCPublishMessage publishMessage = new SCPublishMessage(new byte[128]);
View Full Code Here

   * Description:  publish 100000 uncompressed messages � 128 bytes to the server.<br>
   * Expectation:  passes
   */
  @Test
  public void publish_100000_msg_uncompressed() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_PUB_SRV_TCP, ConnectionType.NETTY_TCP);
    server.startListener();
    publishServer = server.newPublishServer(TestConstants.pubServiceName1);
    SCPublishServerCallback cbk = new PubSrvCallback(publishServer);
    publishServer.register(10, 2, cbk);
    SCPublishMessage publishMessage = new SCPublishMessage(new byte[128]);
View Full Code Here

  public void run() {

    List<String> nics = new ArrayList<String>();
    nics.add("localhost");

    SCServer sc = new SCServer("localhost", 9000, nics, 9002, ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE);

    try {
      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "session-1";
      SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
      int maxSess = 100;
      int maxConn = 10;
      SCSessionServerCallback cbk = newSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }
  }
View Full Code Here

        Thread.sleep(200);
        this.server.deregister();
      } catch (Exception e) {
        LOGGER.error("run", e);
      } finally {
        SCServer sc = server.getSCServer();
        sc.stopListener();
        sc.destroy();
      }
    }
View Full Code Here

  public void run() {

    List<String> nics = new ArrayList<String>();
    nics.add("localhost");

    SCServer sc = new SCServer("localhost", 9000, nics, 9002, ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE);

    try {
      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "session-1";
      SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
      int maxSess = 100;
      int maxConn = 10;
      SCSessionServerCallback cbk = newSessionSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }

    try {
      String serviceName = "cacheGuardian1";
      SCPublishServer server = sc.newPublishServer(serviceName);
      int maxSess = 100;
      int maxConn = 10;
      SCPublishServerCallback cbk = newPublishSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }
  }
View Full Code Here

        Thread.sleep(200);
        this.server.deregister();
      } catch (Exception e) {
        LOGGER.error("run", e);
      } finally {
        SCServer sc = server.getSCServer();
        sc.stopListener();
        sc.destroy();
      }
    }
View Full Code Here

   * Description: Invoke SCServer constructor with host, port and listener port. <br>
   * Expectation: Host, Port and listener Port was set
   */
  @Test
  public void t01_constructor() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_SES_SRV_TCP);
    Assert.assertEquals("Host not equal", TestConstants.HOST, server.getSCHost());
    Assert.assertEquals("Port not equal", TestConstants.PORT_SC0_TCP, server.getSCPort());
    Assert.assertEquals("Listener Port not equal", TestConstants.PORT_SES_SRV_TCP, server.getListenerPort());
    Assert.assertEquals("Default ConnectionType not set", ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE, server
        .getConnectionType());
View Full Code Here

   * Description: Invoke SCServer constructor with host=null, port and listener port. <br>
   * Expectation: throws SCMPValidatorException
   */
  @Test(expected = SCMPValidatorException.class)
  public void t02_constructor() throws Exception {
    server = new SCServer(null, TestConstants.PORT_SC0_TCP, TestConstants.PORT_SES_SRV_TCP);
    Assert.assertEquals("Host not equal", null, server.getSCHost());
    Assert.assertEquals("Port not equal", TestConstants.PORT_SC0_TCP, server.getSCPort());
    Assert.assertEquals("Listener Port not equal", TestConstants.PORT_SES_SRV_TCP, server.getListenerPort());
    Assert.assertEquals("Default ConnectionType not set", ConnectionType.DEFAULT_SERVER_CONNECTION_TYPE, server
        .getConnectionType());
View Full Code Here

TOP

Related Classes of org.serviceconnector.api.srv.SCServer

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.