コード例 #1
0
  @BeforeClass
  public static void initialization() {
    boolean enableSslLbPort = false;
    boolean terminateTLSTraffic = true;
    // start lb
    balancer = new BalancerRunner();
    balancer.start(ConfigInit.getLbSpliterProperties(enableSslLbPort, terminateTLSTraffic));
    // start servers
    serverArray = new DefaultSmppServer[serverNumbers];
    serverHandlerArray = new DefaultSmppServerHandler[serverNumbers];
    for (int i = 0; i < serverNumbers; i++) {
      serverHandlerArray[i] = new DefaultSmppServerHandler();
      serverArray[i] =
          new DefaultSmppServer(
              ConfigInit.getSmppServerConfiguration(i, false),
              serverHandlerArray[i],
              executor,
              monitorExecutor);
      logger.info("Starting SMPP server...");
      try {
        serverArray[i].start();
      } catch (SmppChannelException e) {
        logger.info("SMPP server does not started");
        e.printStackTrace();
      }

      logger.info("SMPP server started");
    }
    try {
      Thread.sleep(2000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #2
0
  @Before
  public void setUp() throws Exception {
    shootist = new Shootist();
    balancer = new BalancerRunner();
    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "SipBalancerForwarder");
    properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    // You need 16 for logging traces. 32 for debug + traces.
    // Your code will limp at 32 but it is best for debugging.
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
    properties.setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "2");
    properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
    properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
    properties.setProperty("algorithmClass", WorstCaseUdpTestAffinityAlgorithm.class.getName());
    properties.setProperty("host", "127.0.0.1");
    properties.setProperty("internalPort", "5065");
    properties.setProperty("externalPort", "5060");
    balancer.start(properties);

    for (int q = 0; q < servers.length; q++) {
      servers[q] =
          new AppServer(
              "node" + q, 4060 + q, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.UDP);
      servers[q].start();
    }
    Thread.sleep(5000);
  }