Java Code Examples for org.mobicents.protocols.api.IpChannelType#TCP
The following examples show how to use
org.mobicents.protocols.api.IpChannelType#TCP .
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: NettySctpClientHandler.java From sctp with GNU Affero General Public License v3.0 | 6 votes |
@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 2
Source File: UpdateLocationResp.java From SigPloit with MIT License | 5 votes |
public static void main(String args[]) { System.out.println("*********************************************"); System.out.println("*** Updating New Location ***"); System.out.println("*********************************************"); IpChannelType ipChannelType = IpChannelType.SCTP; //IpChannelType ipChannelType = IpChannelType.TCP; if (args.length >= 1 && args[0].toLowerCase().equals("tcp")) { ipChannelType = IpChannelType.TCP; } final UpdateLocationResp victim = new UpdateLocationResp(); logger.setLevel(org.apache.log4j.Level.DEBUG); try { victim.initializeStack(ipChannelType); // Lets pause for 20 seconds so stacks are initialized properly Thread.sleep(20000); //victim.initiateSRISMResp(); } catch (Exception e) { e.printStackTrace(); } }
Example 3
Source File: SS7Honeypot.java From SigFW with GNU Affero General Public License v3.0 | 4 votes |
/** * @param args */ public static void main(String[] args) { logger.debug("*************************************"); logger.debug("*** SS7Server ***"); logger.debug("*************************************"); // clear XML dir File index = new File(persistDir); if (!index.exists()) { index.mkdir(); } else { String[]entries = index.list(); for(String s: entries){ File currentFile = new File(index.getPath(),s); currentFile.delete(); } } // IpChannelType ipChannelType = IpChannelType.SCTP; if (args.length >= 1 && args[0].toLowerCase().equals("tcp")) { ipChannelType = IpChannelType.TCP; } logger.setLevel(org.apache.log4j.Level.DEBUG); final SS7Honeypot server = new SS7Honeypot(); try { server.initializeStack(ipChannelType); } catch (Exception e) { e.printStackTrace(); } try { while (true) { if(server.serverM3UAMgmt.isStarted() == true) { for (As a : server.serverM3UAMgmt.getAppServers()) { if (a.isConnected() && a.isUp()) { //server.initiateUSSD(); } } } else { //server.serverM3UAMgmt.start(); } Thread.sleep(1000); } } catch (Exception ex) { java.util.logging.Logger.getLogger(SS7Honeypot.class.getName()).log(Level.SEVERE, null, ex); } }
Example 4
Source File: SS7Server.java From SigFW with GNU Affero General Public License v3.0 | 4 votes |
/** * @param args */ public static void main(String[] args) { logger.debug("*************************************"); logger.debug("*** SS7Server ***"); logger.debug("*************************************"); // clear XML dir File index = new File(persistDir); if (!index.exists()) { index.mkdir(); } else { String[]entries = index.list(); for(String s: entries){ File currentFile = new File(index.getPath(),s); currentFile.delete(); } } // IpChannelType ipChannelType = IpChannelType.SCTP; if (args.length >= 1 && args[0].toLowerCase().equals("tcp")) { ipChannelType = IpChannelType.TCP; } logger.setLevel(org.apache.log4j.Level.DEBUG); final SS7Server server = new SS7Server(); try { server.initializeStack(ipChannelType); } catch (Exception e) { e.printStackTrace(); } try { while (true) { if(server.serverM3UAMgmt.isStarted() == true) { for (As a : server.serverM3UAMgmt.getAppServers()) { if (a.isConnected() && a.isUp()) { //server.initiateUSSD(); } } } else { //server.serverM3UAMgmt.start(); } Thread.sleep(1000); } } catch (Exception ex) { java.util.logging.Logger.getLogger(SS7Server.class.getName()).log(Level.SEVERE, null, ex); } }
Example 5
Source File: Server.java From gmlc with GNU Affero General Public License v3.0 | 4 votes |
public static void main(String[] args) { IpChannelType ipChannelType = IpChannelType.SCTP; if (args.length >= 1 && args[0].toLowerCase().equals("tcp")) { ipChannelType = IpChannelType.TCP; } else { ipChannelType = IpChannelType.SCTP; } logger.info("IpChannelType=" + ipChannelType); if (args.length >= 2) { TestHarness.CLIENT_IP = args[1]; } logger.info("CLIENT_IP=" + TestHarness.CLIENT_IP); if (args.length >= 3) { TestHarness.CLIENT_PORT = Integer.parseInt(args[2]); } logger.info("CLIENT_PORT=" + TestHarness.CLIENT_PORT); if (args.length >= 4) { TestHarness.SERVER_IP = args[3]; } logger.info("SERVER_IP=" + TestHarness.SERVER_IP); if (args.length >= 5) { TestHarness.SERVER_PORT = Integer.parseInt(args[4]); } logger.info("SERVER_PORT=" + TestHarness.SERVER_PORT); if (args.length >= 6) { TestHarness.CLIENT_SPC = Integer.parseInt(args[5]); } logger.info("CLIENT_SPC=" + TestHarness.CLIENT_SPC); if (args.length >= 7) { TestHarness.SERVER_SPC = Integer.parseInt(args[6]); } logger.info("SERVET_SPC=" + TestHarness.SERVER_SPC); if (args.length >= 8) { TestHarness.NETWORK_INDICATOR = Integer.parseInt(args[7]); } logger.info("NETWORK_INDICATOR=" + TestHarness.NETWORK_INDICATOR); if (args.length >= 9) { TestHarness.SERVICE_INDICATOR = Integer.parseInt(args[8]); } logger.info("SERVICE_INDICATOR=" + TestHarness.SERVICE_INDICATOR); if (args.length >= 10) { TestHarness.SERVER_SSN = Integer.parseInt(args[9]); } logger.info("SSN=" + TestHarness.SERVER_SSN); if (args.length >= 11) { TestHarness.ROUTING_CONTEXT = Integer.parseInt(args[10]); } logger.info("ROUTING_CONTEXT=" + TestHarness.ROUTING_CONTEXT); if (args.length >= 12) { TestHarness.DELIVERY_TRANSFER_MESSAGE_THREAD_COUNT = Integer.parseInt(args[11]); } logger.info("DELIVERY_TRANSFER_MESSAGE_THREAD_COUNT=" + TestHarness.DELIVERY_TRANSFER_MESSAGE_THREAD_COUNT); final Server server = new Server(); try { server.initializeStack(ipChannelType); } catch (Exception e) { e.printStackTrace(); } }
Example 6
Source File: NettyAddressInUseTest.java From sctp with GNU Affero General Public License v3.0 | 4 votes |
private void testAddressInUseByProtocol(IpChannelType ipChannelType) throws Exception { this.setUp(ipChannelType); this.management.startServer(SERVER_NAME); this.serverAssociation.setAssociationListener(new ServerAssociationListener()); this.management.startAssociation(SERVER_ASSOCIATION_NAME); // making the client association local port busy if (ipChannelType == IpChannelType.TCP) { doInitSocketServerTcp(); } else { doInitSocketServerSctp(); } Thread.sleep(100); this.clientAssociation.setAssociationListener(new ClientAssociationListener()); this.management.startAssociation(CLIENT_ASSOCIATION_NAME); Thread.sleep(1000 * 9); assertFalse(clientAssocUp); assertFalse(serverAssocUp); assertFalse(this.clientAssociation.isConnected()); assertFalse(this.serverAssociation.isConnected()); if (ipChannelType == IpChannelType.TCP) { dirtyServerTcp.close(); } else { dirtyServerSctp.close(); } for (int i1 = 0; i1 < 15; i1++) { Thread.sleep(1000 * 1); if (clientAssocUp) break; } Thread.sleep(200); assertTrue(clientAssocUp); assertTrue(serverAssocUp); assertTrue(this.clientAssociation.isConnected()); assertTrue(this.serverAssociation.isConnected()); this.management.stopAssociation(CLIENT_ASSOCIATION_NAME); Thread.sleep(1000); assertTrue(clientAssocDown); assertTrue(serverAssocDown); assertFalse(this.clientAssociation.isConnected()); assertFalse(this.serverAssociation.isConnected()); this.management.stopAssociation(SERVER_ASSOCIATION_NAME); this.management.stopServer(SERVER_NAME); Thread.sleep(1000 * 2); Runtime runtime = Runtime.getRuntime(); this.tearDown(); }
Example 7
Source File: AddressInUseTest.java From sctp with GNU Affero General Public License v3.0 | 4 votes |
private void testAddressInUseByProtocol(IpChannelType ipChannelType) throws Exception { this.setUp(ipChannelType); this.management.startServer(SERVER_NAME); this.serverAssociation.setAssociationListener(new ServerAssociationListener()); this.management.startAssociation(SERVER_ASSOCIATION_NAME); // making the client association local port busy if (ipChannelType == IpChannelType.TCP) { doInitSocketServerTcp(); } else { doInitSocketServerSctp(); } Thread.sleep(100); this.clientAssociation.setAssociationListener(new ClientAssociationListener()); this.management.startAssociation(CLIENT_ASSOCIATION_NAME); Thread.sleep(1000 * 9); assertFalse(clientAssocUp); assertFalse(serverAssocUp); assertFalse(this.clientAssociation.isConnected()); assertFalse(this.serverAssociation.isConnected()); if (ipChannelType == IpChannelType.TCP) { dirtyServerTcp.close(); } else { dirtyServerSctp.close(); } for (int i1 = 0; i1 < 15; i1++) { Thread.sleep(1000 * 1); if (clientAssocUp) break; } Thread.sleep(200); assertTrue(clientAssocUp); assertTrue(serverAssocUp); assertTrue(this.clientAssociation.isConnected()); assertTrue(this.serverAssociation.isConnected()); this.management.stopAssociation(CLIENT_ASSOCIATION_NAME); Thread.sleep(1000); assertTrue(clientAssocDown); assertTrue(serverAssocDown); assertFalse(this.clientAssociation.isConnected()); assertFalse(this.serverAssociation.isConnected()); this.management.stopAssociation(SERVER_ASSOCIATION_NAME); this.management.stopServer(SERVER_NAME); Thread.sleep(1000 * 2); // assertTrue(Arrays.equals(SERVER_MESSAGE, clientMessage)); // assertTrue(Arrays.equals(CLIENT_MESSAGE, serverMessage)); Runtime runtime = Runtime.getRuntime(); this.tearDown(); }
Example 8
Source File: ProvideSubscriberInformationResp.java From SigPloit with MIT License | 3 votes |
public static void main(String args[]) { System.out.println("*********************************************"); System.out.println("*** Subscriber Information ***"); System.out.println("*********************************************"); IpChannelType ipChannelType = IpChannelType.SCTP; if (args.length >= 1 && args[0].toLowerCase().equals("tcp")) { ipChannelType = IpChannelType.TCP; } final ProvideSubscriberInformationResp victim = new ProvideSubscriberInformationResp(); 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(); } }