Search in sources :

Example 16 with DefaultSmppServer

use of com.cloudhopper.smpp.impl.DefaultSmppServer in project load-balancer by RestComm.

the class SpliterModeTest method initialization.

@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();
    }
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SmppChannelException(com.cloudhopper.smpp.type.SmppChannelException) BeforeClass(org.junit.BeforeClass)

Example 17 with DefaultSmppServer

use of com.cloudhopper.smpp.impl.DefaultSmppServer in project load-balancer by RestComm.

the class SpliterModeTest method testTransfer.

@Test
public void testTransfer() {
    int clientNumbers = 9;
    clientHandlerArray = new DefaultSmppClientHandler[clientNumbers];
    int sms = 99;
    Locker locker = new Locker(clientNumbers);
    ArrayList<Load> processors = new ArrayList<Load>(clientNumbers);
    for (int i = 0; i < clientNumbers; i++) processors.add(new Load(i, sms, locker));
    for (int i = 0; i < clientNumbers; i++) processors.get(i).start();
    locker.waitForClients();
    for (DefaultSmppServerHandler serverHandler : serverHandlerArray) assertEquals(sms, serverHandler.smsNumber);
    for (DefaultSmppServer server : serverArray) assertEquals(clientNumbers / serverNumbers, server.getBindRequested());
    for (DefaultSmppClientHandler clientHandler : clientHandlerArray) assertEquals(sms, clientHandler.getReponsesNumber().get());
    assertTrue(((BalancerDispatcher) balancer.smppBalancerRunner.getBalancerDispatcher()).getClientSessions().isEmpty());
    assertTrue(((BalancerDispatcher) balancer.smppBalancerRunner.getBalancerDispatcher()).getServerSessions().isEmpty());
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerDispatcher(org.mobicents.tools.smpp.balancer.core.BalancerDispatcher) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 18 with DefaultSmppServer

use of com.cloudhopper.smpp.impl.DefaultSmppServer in project load-balancer by RestComm.

the class SslBalancerSslServerTest method initialization.

@BeforeClass
public static void initialization() {
    boolean enableSslLbPort = true;
    boolean terminateTLSTraffic = false;
    // start lb
    balancer = new BalancerRunner();
    balancer.start(ConfigInit.getLbProperties(enableSslLbPort, terminateTLSTraffic));
    // start servers
    serverArray = new DefaultSmppServer[serverNumbers];
    for (int i = 0; i < serverNumbers; i++) {
        serverHandlerArray[i] = new DefaultSmppServerHandler();
        serverArray[i] = new DefaultSmppServer(ConfigInit.getSmppServerConfiguration(i, true), 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();
    }
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SmppChannelException(com.cloudhopper.smpp.type.SmppChannelException) BeforeClass(org.junit.BeforeClass)

Example 19 with DefaultSmppServer

use of com.cloudhopper.smpp.impl.DefaultSmppServer in project load-balancer by RestComm.

the class TwoNicTest method initialization.

@BeforeClass
public static void initialization() {
    boolean enableSslLbPort = false;
    boolean terminateTLSTraffic = true;
    // start lb
    balancer = new BalancerRunner();
    ConfigInit.getLbProperties(enableSslLbPort, terminateTLSTraffic).getSmppConfiguration().setTimeoutConnection(2000);
    ConfigInit.getLbProperties(enableSslLbPort, terminateTLSTraffic).getSmppConfiguration().setTimeoutConnectionCheckClientSide(5000);
    ConfigInit.getLbProperties(enableSslLbPort, terminateTLSTraffic).getSmppConfiguration().setTimeoutConnectionCheckServerSide(5000);
    balancer.start(ConfigInit.getLbPropertiesTwoNic(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();
    }
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) SmppChannelException(com.cloudhopper.smpp.type.SmppChannelException) BeforeClass(org.junit.BeforeClass)

Example 20 with DefaultSmppServer

use of com.cloudhopper.smpp.impl.DefaultSmppServer in project load-balancer by RestComm.

the class BindingWithIncorrectSystemidTest method initialization.

@BeforeClass
public static void initialization() {
    // start lb
    balancer = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = ConfigInit.getLbPropertiesWithOneServer();
    lbConfig.getSmppConfiguration().setReconnectPeriod(2000);
    balancer.start(lbConfig);
    // start servers
    serverHandler = new DefaultSmppServerHandler();
    server = new DefaultSmppServer(ConfigInit.getSmppServerConfiguration(0, false), serverHandler, executor, monitorExecutor);
    logger.info("Starting SMPP server...");
    try {
        server.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) {
        e.printStackTrace();
    }
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) SmppChannelException(com.cloudhopper.smpp.type.SmppChannelException) BeforeClass(org.junit.BeforeClass)

Aggregations

DefaultSmppServer (com.cloudhopper.smpp.impl.DefaultSmppServer)21 SmppChannelException (com.cloudhopper.smpp.type.SmppChannelException)19 BeforeClass (org.junit.BeforeClass)19 BalancerRunner (org.mobicents.tools.sip.balancer.BalancerRunner)19 LoadBalancerConfiguration (org.mobicents.tools.configuration.LoadBalancerConfiguration)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 BalancerDispatcher (org.mobicents.tools.smpp.balancer.core.BalancerDispatcher)2 UrlRewriteTest (org.mobicents.tools.http.balancer.UrlRewriteTest)1