use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.
the class MediaFailureTest method setUp.
public void setUp() throws Exception {
shootist = new Shootist(ListeningPoint.TCP, 5060);
balancer = new BalancerRunner();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "2");
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
lbConfig.getSipConfiguration().getExternalLegConfiguration().setTcpPort(5060);
lbConfig.getSipConfiguration().getInternalLegConfiguration().setTcpPort(5065);
ArrayList<Integer> statusRemoval = new ArrayList<Integer>();
statusRemoval.add(503);
lbConfig.getSipConfiguration().setResponseStatusCodeNodeRemoval(statusRemoval);
lbConfig.getSipConfiguration().setMaxNumberResponsesWithError(2);
lbConfig.getSipConfiguration().setMaxErrorTime(3000000l);
balancer.start(lbConfig);
goodServer = new AppServer("node0", 4060, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2223);
badServer = new AppServer("node1", 4061, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, false, true);
goodServer.start();
Thread.sleep(5000);
badServer.start();
Thread.sleep(5000);
}
use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.
the class NoInternalAddressTest method setUp.
@Before
public void setUp() throws Exception {
shootist = new Shootist();
balancer = new BalancerRunner();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
lbConfig.getCommonConfiguration().setHost(null);
lbConfig.getSipConfiguration().getExternalLegConfiguration().setHost("127.0.0.1");
lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
balancer.start(lbConfig);
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, 2222 + q);
servers[q].start();
}
Thread.sleep(5000);
}
use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.
the class RegexTest method setUp.
public void setUp() throws Exception {
shootist = new Shootist(ListeningPoint.TCP, 5060);
balancer = new BalancerRunner();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
lbConfig.getSipConfiguration().getExternalLegConfiguration().setUdpPort(5060);
lbConfig.getSipConfiguration().getInternalLegConfiguration().setTcpPort(5065);
lbConfig.getSipConfiguration().getAlgorithmConfiguration().setAlgorithmClass(UserBasedAlgorithm.class.getCanonicalName());
lbConfig.getSipConfiguration().getAlgorithmConfiguration().setSipHeaderAffinityKey("From");
balancer.start(lbConfig);
node0 = new AppServer("node0", 4060, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2222);
node1 = new AppServer("node1", 4061, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2223);
node0.start();
Thread.sleep(1000);
node1.start();
Thread.sleep(1000);
}
use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.
the class RegisterWithNexmoPropertyTest method testRegisterWithNexmoProperty.
@Test
public void testRegisterWithNexmoProperty() throws Exception {
EventListener failureEventListener = new EventListener() {
@Override
public void uasAfterResponse(int statusCode, AppServer source) {
}
@Override
public void uasAfterRequestReceived(String method, AppServer source) {
if (method.equals(SIPRequest.REGISTER))
register = source;
}
@Override
public void uacAfterRequestSent(String method, AppServer source) {
}
@Override
public void uacAfterResponse(int statusCode, AppServer source) {
}
};
for (AppServer as : servers) as.setEventListener(failureEventListener);
shootist.sendInitial("KostyaNosach", "here.com", SIPRequest.REGISTER, null, null, null);
Thread.sleep(3000);
assertNotNull(register);
assertEquals(200, shootist.responses.get(0).getStatusCode());
}
use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.
the class RollingUpgradeTest method setUp.
@Before
public void setUp() {
shootist = new Shootist();
String externalIpLBString = "";
String internalIpLBString = "";
for (int q = 0; q < numBalancers; q++) {
balancers[q] = prepBalancer(q);
externalIpLBString += "127.0.0.1:" + 5 + q + "60,";
internalIpLBString += "127.0.0.1:" + 5 + q + "65,";
}
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, 2222 + q);
servers[q].setBalancers(loadbalancers);
servers[q].start();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
externalIpLoadBalancer = new UDPPacketForwarder(9988, externalIpLBString, "127.0.0.1");
externalIpLoadBalancer.start();
internalIpLoadBalancer = new UDPPacketForwarder(9922, internalIpLBString, "127.0.0.1");
internalIpLoadBalancer.start();
Helper.sleep(5000);
}
Aggregations