org.mobicents.protocols.api.IpChannelType Java Examples

The following examples show how to use org.mobicents.protocols.api.IpChannelType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SendRoutingInfoResp.java    From SigPloit with MIT License 7 votes vote down vote up
protected void initializeStack(IpChannelType ipChannelType) throws Exception {

        this.initSCTP(ipChannelType);

        // Initialize M3UA first
        this.initM3UA();

        // Initialize SCCP
        this.initSCCP();

        // Initialize TCAP
        this.initTCAP();

        // Initialize MAP
        this.initMAP();

        // FInally start ASP
        // Set 5: Finally start ASP
        this.serverM3UAMgmt.startAsp("SASP1");
    }
 
Example #2
Source File: SendRoutingInfoForGPRS.java    From SigPloit with MIT License 6 votes vote down vote up
protected void initializeStack(IpChannelType ipChannelType) throws Exception {

        this.initSCTP(ipChannelType);

        // Initialize M3UA first
        this.initM3UA();

        // Initialize SCCP
        this.initSCCP();

        // Initialize TCAP
        this.initTCAP();

        // Initialize MAP
        this.initMAP();

        // FInally start ASP
        // Set 5: Finally start ASP
        this.serverM3UAMgmt.startAsp("SASP1");
    }
 
Example #3
Source File: ServerImpl.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void read(javolution.xml.XMLFormat.InputElement xml, ServerImpl server) throws XMLStreamException {
	server.name = xml.getAttribute(NAME, "");
	server.started = xml.getAttribute(STARTED, false);
	server.hostAddress = xml.getAttribute(HOST_ADDRESS, "");
	server.hostport = xml.getAttribute(HOST_PORT, 0);
	server.ipChannelType = IpChannelType.getInstance(xml.getAttribute(IPCHANNEL_TYPE,
			IpChannelType.SCTP.getCode()));
	if (server.ipChannelType == null)
		throw new XMLStreamException("Bad value for server.ipChannelType");

	server.acceptAnonymousConnections = xml.getAttribute(ACCEPT_ANONYMOUS_CONNECTIONS, false);
          server.maxConcurrentConnectionsCount = xml.getAttribute(MAX_CONCURRENT_CONNECTIONS_COUNT, 0);

	int extraHostAddressesSize = xml.getAttribute(EXTRA_HOST_ADDRESS_SIZE, 0);
	server.extraHostAddresses = new String[extraHostAddressesSize];
	
	for(int i=0;i<extraHostAddressesSize;i++){
		server.extraHostAddresses[i] = xml.get(EXTRA_HOST_ADDRESS, String.class);
	}
	
	server.associations = xml.get(ASSOCIATIONS, FastList.class);
}
 
Example #4
Source File: SctpTransferTest.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
public void setUp(IpChannelType ipChannelType) throws Exception {
	this.clientMaxInboundStreams = 0;
	this.serverMaxOutboundStreams = 0;
	
	this.clientAssocUp = false;
	this.serverAssocUp = false;

	this.clientAssocDown = false;
	this.serverAssocDown = false;

	this.clientMessage = null;
	this.serverMessage = null;

	this.management = new ManagementImpl("server-management");
	this.management.setSingleThread(true);
	this.management.start();
       this.management.setConnectDelay(10000);// Try connecting every 10 secs
	this.management.removeAllResourses();

	this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null);
	this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
	this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType,
			null);
}
 
Example #5
Source File: NettySctpClientHandler.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void channelActive(ChannelHandlerContext ctx) {
    if (logger.isDebugEnabled()) {
        logger.debug(String.format("channelActive event: association=%s", this.association));
    }

    this.ctx = ctx;
    this.channel = ctx.channel();
    this.association.setChannelHandler(this);

    String host = null;
    int port = 0;
    InetSocketAddress sockAdd = ((InetSocketAddress) channel.remoteAddress());
    if (sockAdd != null) {
        host = sockAdd.getAddress().getHostAddress();
        port = sockAdd.getPort();
    }

    if (logger.isInfoEnabled()) {
        logger.info(String.format("Association=%s connected to host=%s port=%d", association.getName(), host, port));
    }

    if (association.getIpChannelType() == IpChannelType.TCP) {
        this.association.markAssociationUp(1, 1);
    }
}
 
Example #6
Source File: AddressInUseTest.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
public void setUp(IpChannelType ipChannelType) throws Exception {
		this.clientAssocUp = false;
		this.serverAssocUp = false;

		this.clientAssocDown = false;
		this.serverAssocDown = false;

//		this.clientMessage = null;
//		this.serverMessage = null;

		this.management = new ManagementImpl("server-management");
		this.management.setSingleThread(true);
		this.management.start();
        this.management.setConnectDelay(5000);// Try connecting every 5 secs
		this.management.removeAllResourses();

		this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null);
		this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
		this.clientAssociation = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType,
				null);
	}
 
Example #7
Source File: ModifyAssociationTest.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
public void setUp(IpChannelType ipChannelType, int serverPort, int clientPort) throws Exception {
	this.clientAssocUp = false;
	this.serverAssocUp = false;

	this.clientAssocDown = false;
	this.serverAssocDown = false;

	this.clientMessage = null;
	this.serverMessage = null;

	this.management = new ManagementImpl("ClientAssociationTest");
	this.management.setSingleThread(true);
	this.management.start();
       this.management.setConnectDelay(1000);
	this.management.removeAllResourses();

	this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, serverPort, ipChannelType, false, 0, null);
	this.serverAssociation = this.management.addServerAssociation(CLIENT_HOST, clientPort, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
	this.clientAssociation = this.management.addAssociation(CLIENT_HOST, clientPort, SERVER_HOST, serverPort, CLIENT_ASSOCIATION_NAME, ipChannelType, null);
}
 
Example #8
Source File: DiameterFirewallPerformanceTests.java    From SigFW with GNU Affero General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {
    DiameterFirewallPerformanceTests ec = new DiameterFirewallPerformanceTests();
    try {
        ec.initSCTP(IpChannelType.SCTP);

        ec.start();

        while (!ec.finished()) {
            try {
                Thread.currentThread().sleep(5000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    } catch (Exception ex) {
        java.util.logging.Logger.getLogger(DiameterFirewallPerformanceTests.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
Example #9
Source File: SS7ClientLiveInput.java    From SigFW with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initSCTP(IpChannelType ipChannelType) throws Exception {
    logger.debug("Initializing SCTP Stack ....");
    this.sctpManagement = new ManagementImpl("SctpClientSCTP");
    
    this.sctpManagement.setPersistDir(persistDir);
    
    this.sctpManagement.setSingleThread(false);
    this.sctpManagement.start();
    this.sctpManagement.setConnectDelay(10000);
    this.sctpManagement.setMaxIOErrors(30);
    this.sctpManagement.removeAllResourses();
    this.sctpManagement.addManagementEventListener(this);

    // 1. Create SCTP Association
    sctpManagement.addAssociation(CLIENT_IP, CLIENT_PORT, SERVER_IP, /*SERVER_PORT*/3433, CLIENT_ASSOCIATION_NAME,
            ipChannelType, null);
    logger.debug("Initialized SCTP Stack ....");
    
}
 
Example #10
Source File: ProvideSubscriberInformationResp.java    From SigPloit with MIT License 6 votes vote down vote up
protected void initializeStack(IpChannelType ipChannelType) throws Exception {

        this.initSCTP(ipChannelType);

        // Initialize M3UA first
        this.initM3UA();

        // Initialize SCCP
        this.initSCCP();

        // Initialize TCAP
        this.initTCAP();

        // Initialize MAP
        this.initMAP();

        // FInally start ASP
        // Set 5: Finally start ASP
        this.serverM3UAMgmt.startAsp("SASP1");
    }
 
Example #11
Source File: ProvideSubscriberInformationResp.java    From SigPloit with MIT License 6 votes vote down vote up
private void initSCTP(IpChannelType ipChannelType) throws Exception {
    logger.debug("Initializing SCTP Stack ....");
    this.sctpManagement = new ManagementImpl("Server");
    this.sctpManagement.setSingleThread(true);
    this.sctpManagement.start();
    this.sctpManagement.setConnectDelay(10000);
    this.sctpManagement.removeAllResourses();

    //1. Create SCTP Server
    sctpManagement.addServer(SERVER_NAME, SERVER_IP,SERVER_PORT, ipChannelType,null);
    // 2. Create SCTP Association
    sctpManagement.addServerAssociation(CLIENT_IP, CLIENT_PORT, SERVER_NAME,SERVER_ASSOCIATION_NAME,ipChannelType);
    //3. Start Sever
    sctpManagement.startServer(SERVER_NAME);

    logger.debug("Initialized SCTP Stack ....");
}
 
Example #12
Source File: NettyAddressInUseTest.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
public void setUp(IpChannelType ipChannelType) throws Exception {
        this.clientAssocUp = false;
        this.serverAssocUp = false;

        this.clientAssocDown = false;
        this.serverAssocDown = false;

        this.management = new NettySctpManagementImpl("server-management");
//        this.management.setSingleThread(true);
        this.management.start();
        this.management.setConnectDelay(5000);// Try connecting every 5 secs
        this.management.removeAllResourses();

        this.server = (NettyServerImpl) this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false,
                0, null);
        this.serverAssociation = (NettyAssociationImpl) this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT,
                SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
        this.clientAssociation = (NettyAssociationImpl) this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST,
                SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType, null);
    }
 
Example #13
Source File: NettyModifyAssociationTest.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
public void setUp(IpChannelType ipChannelType, int serverPort, int clientPort) throws Exception {
	this.clientAssocUp = false;
	this.serverAssocUp = false;

	this.clientAssocDown = false;
	this.serverAssocDown = false;

	this.clientMessage = null;
	this.serverMessage = null;

	this.management = new NettySctpManagementImpl("ClientAssociationTest");
	this.management.setSingleThread(true);
	this.management.start();
       this.management.setConnectDelay(1000);
	this.management.removeAllResourses();

	this.server = (NettyServerImpl) this.management.addServer(SERVER_NAME, SERVER_HOST, serverPort, ipChannelType, false, 0, null);
	this.serverAssociation = (NettyAssociationImpl) this.management.addServerAssociation(CLIENT_HOST, clientPort, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
	this.clientAssociation = (NettyAssociationImpl) this.management.addAssociation(CLIENT_HOST, clientPort, SERVER_HOST, serverPort, CLIENT_ASSOCIATION_NAME, ipChannelType, null);
}
 
Example #14
Source File: Server.java    From gmlc with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initSCTP(IpChannelType ipChannelType) throws Exception {
  this.sctpManagement = new NettySctpManagementImpl("Server");
  // this.sctpManagement.setSingleThread(false);
  this.sctpManagement.start();
  this.sctpManagement.setConnectDelay(10000);
  this.sctpManagement.removeAllResourses();

  // 1. Create SCTP Server
  sctpManagement.addServer(SERVER_NAME, SERVER_IP, SERVER_PORT, ipChannelType, null);

  // 2. Create SCTP Server Association
  sctpManagement.addServerAssociation(CLIENT_IP, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);

  // 3. Start Server
  sctpManagement.startServer(SERVER_NAME);
}
 
Example #15
Source File: UpdateLocationResp.java    From SigPloit with MIT License 6 votes vote down vote up
private void initSCTP(IpChannelType ipChannelType) throws Exception {
    logger.debug("Initializing SCTP Stack ....");
    this.sctpManagement = new ManagementImpl("Server");
    this.sctpManagement.setSingleThread(true);
    this.sctpManagement.start();
    this.sctpManagement.setConnectDelay(10000);
    this.sctpManagement.removeAllResourses();

    //1. Create SCTP Server
    sctpManagement.addServer(SERVER_NAME, SERVER_IP,SERVER_PORT, ipChannelType,null);
    // 2. Create SCTP Association
    sctpManagement.addServerAssociation(CLIENT_IP, CLIENT_PORT, SERVER_NAME,SERVER_ASSOCIATION_NAME,ipChannelType);
    //3. Start Sever
    sctpManagement.startServer(SERVER_NAME);

    logger.debug("Initialized SCTP Stack ....");
}
 
Example #16
Source File: SendIMSIResp.java    From SigPloit with MIT License 6 votes vote down vote up
public static void main(String args[]) {
    System.out.println("*********************************************");
    System.out.println("***      IMSI Information - HLR           ***");
    System.out.println("*********************************************");
    IpChannelType ipChannelType = IpChannelType.SCTP;

    final SendIMSIResp victim = new SendIMSIResp();

    logger.setLevel(org.apache.log4j.Level.DEBUG);

    try {
        victim.initializeStack(ipChannelType);

        // Lets pause for 20 seconds so stacks are initialized properly
        Thread.sleep(20000);


    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #17
Source File: NettySctpMultiHomeTransferTest.java    From sctp with GNU Affero General Public License v3.0 6 votes vote down vote up
public void setUp(IpChannelType ipChannelType) throws Exception {
        this.clientAssocUp = false;
        this.serverAssocUp = false;

        this.clientAssocDown = false;
        this.serverAssocDown = false;

        this.clientMessage = new FastList<String>();
        this.serverMessage = new FastList<String>();

        this.management = new NettySctpManagementImpl("server-management");
//        this.management.setSingleThread(true);
        this.management.start();
        this.management.setConnectDelay(10000);// Try connecting every 10 secs
        this.management.removeAllResourses();

        this.server = (NettyServerImpl) this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false,
                0, new String[] { SERVER_HOST1 });
        this.serverAssociation = (NettyAssociationImpl) this.management.addServerAssociation(CLIENT_HOST, CLIENT_PORT,
                SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
        this.clientAssociation = (NettyAssociationImpl) this.management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST,
                SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType, new String[] { CLIENT_HOST1 });
    }
 
Example #18
Source File: SriSMResp.java    From SigPloit with MIT License 6 votes vote down vote up
private void initSCTP(IpChannelType ipChannelType) throws Exception {
    logger.debug("Initializing SCTP Stack ....");
    this.sctpManagement = new ManagementImpl("Server");
    this.sctpManagement.setSingleThread(true);
    this.sctpManagement.start();
    this.sctpManagement.setConnectDelay(10000);
    this.sctpManagement.removeAllResourses();

    //1. Create SCTP Server
    sctpManagement.addServer(SERVER_NAME, SERVER_IP,SERVER_PORT, ipChannelType,null);
    // 2. Create SCTP Association
    sctpManagement.addServerAssociation(CLIENT_IP, CLIENT_PORT, SERVER_NAME,SERVER_ASSOCIATION_NAME,ipChannelType);
    //3. Start Sever
    sctpManagement.startServer(SERVER_NAME);

    logger.debug("Initialized SCTP Stack ....");
}
 
Example #19
Source File: AssociationImpl.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creating a CLIENT Association
 * 
 * @param hostAddress
 * @param hostPort
 * @param peerAddress
 * @param peerPort
 * @param assocName
 * @param ipChannelType
 * @param extraHostAddresses
 * @throws IOException
 */
public AssociationImpl(String hostAddress, int hostPort, String peerAddress, int peerPort, String assocName,
		IpChannelType ipChannelType, String[] extraHostAddresses) throws IOException {
	this();
	this.hostAddress = hostAddress;
	this.hostPort = hostPort;
	this.peerAddress = peerAddress;
	this.peerPort = peerPort;
	this.name = assocName;
	this.ipChannelType = ipChannelType;
	this.extraHostAddresses = extraHostAddresses;

	this.type = AssociationType.CLIENT;

}
 
Example #20
Source File: AnonymousConnectionTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
public void setUp(IpChannelType ipChannelType) throws Exception {

		this.management = new ManagementImpl("server-management");
		this.management.setSingleThread(true);
		this.management.start();
        this.management.setConnectDelay(CONNECT_DELAY);// Try connecting every x secs
		this.management.removeAllResourses();

		this.management2 = new ManagementImpl("server-management2");
		this.management2.setSingleThread(true);
		this.management2.start();
        this.management2.setConnectDelay(CONNECT_DELAY);// Try connecting every x secs
		this.management2.removeAllResourses();

		this.management3 = new ManagementImpl("server-management3");
		this.management3.setSingleThread(true);
		this.management3.start();
        this.management3.setConnectDelay(CONNECT_DELAY);// Try connecting every x secs
		this.management3.removeAllResourses();

		this.server = this.management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, true, 2, null);
		this.clientAssociation1 = this.management.addAssociation(CLIENT_HOST, CLIENT_PORT1, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME1, ipChannelType,
				null);
		this.clientAssociation2 = this.management2.addAssociation(CLIENT_HOST, CLIENT_PORT2, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME2, ipChannelType,
				null);
		this.clientAssociation3 = this.management3.addAssociation(CLIENT_HOST, CLIENT_PORT3, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME3, ipChannelType,
				null);
	}
 
Example #21
Source File: SelectorThread.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
private void finishConnection(SelectionKey key) throws IOException{
	AssociationImpl association = (AssociationImpl) key.attachment();
	if (association.getIpChannelType() == IpChannelType.SCTP)
		this.finishConnectionSctp(key);
	else
		this.finishConnectionTcp(key);
}
 
Example #22
Source File: AssociationImpl.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creating a SERVER Association
 * 
 * @param peerAddress
 * @param peerPort
 * @param serverName
 * @param assocName
 * @param ipChannelType
 */
public AssociationImpl(String peerAddress, int peerPort, String serverName, String assocName,
		IpChannelType ipChannelType) {
	this();
	this.peerAddress = peerAddress;
	this.peerPort = peerPort;
	this.serverName = serverName;
	this.name = assocName;
	this.ipChannelType = ipChannelType;

	this.type = AssociationType.SERVER;

}
 
Example #23
Source File: SctpTransferTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Simple test that creates Client and Server Association, exchanges data
 * and brings down association. Finally removes the Associations and Server
 */
@Test(groups = { "functional", "sctp" })
public void testDataTransferSctp() throws Exception {

	if (SctpTransferTest.checkSctpEnabled())
		this.testDataTransferByProtocol(IpChannelType.SCTP);
}
 
Example #24
Source File: ManagementTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Test the creation of Server. Stop management and start, and Server should
 * be started automatically
 * 
 * @throws Exception
 */
@Test(groups = { "functional", "sctp" })
public void testServerSctp() throws Exception {
	
	if (SctpTransferTest.checkSctpEnabled())
		this.testServerByProtocol(IpChannelType.SCTP);
}
 
Example #25
Source File: AssociationImpl.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param socketChannel
 *            the socketChannel to set
 */
protected void setSocketChannel(AbstractSelectableChannel socketChannel) {
	if (this.ipChannelType == IpChannelType.SCTP)
		this.socketChannelSctp = (SctpChannel) socketChannel;
	else
		this.socketChannelTcp = (SocketChannel) socketChannel;
}
 
Example #26
Source File: NettyManagementTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Test the creation of Server. Stop management and start, and Server should
 * be started automatically
 * 
 * @throws Exception
 */
@Test(groups = { "functional", "sctp" })
public void testServerSctp() throws Exception {
    
    if (SctpTransferTest.checkSctpEnabled())
        this.testServerByProtocol(IpChannelType.SCTP);
}
 
Example #27
Source File: NettyAssociationImpl.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creating a CLIENT Association
 * 
 * @param hostAddress
 * @param hostPort
 * @param peerAddress
 * @param peerPort
 * @param assocName
 * @param ipChannelType
 * @param extraHostAddresses
 * @throws IOException
 */
public NettyAssociationImpl(String hostAddress, int hostPort, String peerAddress, int peerPort, String assocName,
        IpChannelType ipChannelType, String[] extraHostAddresses) throws IOException {
    this();
    this.hostAddress = hostAddress;
    this.hostPort = hostPort;
    this.peerAddress = peerAddress;
    this.peerPort = peerPort;
    this.name = assocName;
    this.ipChannelType = ipChannelType;
    this.extraHostAddresses = extraHostAddresses;

    this.type = AssociationType.CLIENT;
}
 
Example #28
Source File: NettyManagementTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
private void testStopAssociationByProtocol(IpChannelType ipChannelType) throws Exception {

        NettySctpManagementImpl management = new NettySctpManagementImpl("ManagementTest");
//        management.setSingleThread(true);
        management.start();
        management.setConnectDelay(10000);// Try connecting every 10 secs
        management.removeAllResourses();

        management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, false, 0, null);
        Association serverAssociation = management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);
        Association clientAssociation = management.addAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_HOST, SERVER_PORT, CLIENT_ASSOCIATION_NAME, ipChannelType, null);

        management.startServer(SERVER_NAME);


        serverAssociation.setAssociationListener(new ServerAssociationListener());
        management.startAssociation(SERVER_ASSOCIATION_NAME);
        clientAssociation.setAssociationListener(new ClientAssociationListener());
        management.startAssociation(CLIENT_ASSOCIATION_NAME);

        for (int i1 = 0; i1 < 40; i1++) {
            if (serverAssociation.isConnected())
                break;
            Thread.sleep(1000 * 5);
        }
        Thread.sleep(1000 * 1);

        assertTrue(serverAssociation.isConnected());
        assertTrue(clientAssociation.isConnected());

        management.stop();

        assertFalse(serverAssociation.isConnected());
        assertFalse(clientAssociation.isConnected());

    }
 
Example #29
Source File: ServerImpl.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param name
 * @param ip
 * @param port
 * @throws IOException
 */
public ServerImpl(String name, String hostAddress, int hostport, IpChannelType ipChannelType, boolean acceptAnonymousConnections,
		int maxConcurrentConnectionsCount, String[] extraHostAddresses) throws IOException {
	super();
	this.name = name;
	this.hostAddress = hostAddress;
	this.hostport = hostport;
	this.ipChannelType = ipChannelType;
	this.acceptAnonymousConnections = acceptAnonymousConnections;
	this.maxConcurrentConnectionsCount = maxConcurrentConnectionsCount;
	this.extraHostAddresses = extraHostAddresses;
}
 
Example #30
Source File: AddressInUseTest.java    From sctp with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Simple test that creates Client and Server Association, exchanges data
 * and brings down association. Finally removes the Associations and Server
 */
@Test(groups = { "functional", "sctp" })
public void testAddressInUseSctp() throws Exception {

	if (SctpTransferTest.checkSctpEnabled())
		this.testAddressInUseByProtocol(IpChannelType.SCTP);
}