Examples of SMPPSession


Examples of com.cloudhopper.smpp.SmppSession

        sessionConfig0.setBindTimeout(30000);

        long start = System.currentTimeMillis();
        try {
            // this should fail
            SmppSession session0 = client0.bind(sessionConfig0);
            Assert.fail();
        } catch (SmppChannelException e) {
            long stop = System.currentTimeMillis();
            Assert.assertNotNull(e);
            logger.info("Expected exception: " + e.getMessage());
View Full Code Here

Examples of net.gescobar.smppserver.SmppSession

      String from = "3002175604";
      String text = "this is a test";

      // retrieve the session
      Assert.assertEquals(server.getSessions().size(), 1);
      SmppSession session = server.getSessions().iterator().next();
      Assert.assertNotNull(session);

      // create and send the request
      DeliverSm deliverSM = new DeliverSm();
      deliverSM.setDestAddress(new Address((byte) 0, (byte) 0, to));
      deliverSM.setSourceAddress(new Address((byte) 0, (byte) 0, from));
      deliverSM.setShortMessage(text.getBytes());

      session.sendRequest(deliverSM);

      long timeout = 2000;
      if (!receiveMessage(messageProducer, timeout)) {
        Assert.fail("the message was not received");
      }
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

    String sourceMsisdn = "1616";
    String destinationMsisdn = "666111222";
    MessageClass messageClass = MessageClass.CLASS1;
    String messageBody = "Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, ultricies porta urna.";

    SMPPSession session = new SMPPSession();
    session.addSessionStateListener(new SessionStateListenerImpl());
    session.setMessageReceiverListener(new MessageReceiverListenerImpl());

    try {
      session.connectAndBind("localhost", 2775, new BindParameter(BindType.BIND_TRX, "smppclient", "password",
          "cp", TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));
    } catch (IOException e) {
      System.err.println("Failed connect and bind to host");
      e.printStackTrace();
    }

    // configure variables acording to if message contains national
    // characters
    Alphabet alphabet = null;
    int maximumSingleMessageSize = 0;
    int maximumMultipartMessageSegmentSize = 0;
    byte[] byteSingleMessage = null;
    if (Gsm0338.isEncodeableInGsm0338(messageBody)) {
      byteSingleMessage = messageBody.getBytes();
      alphabet = Alphabet.ALPHA_DEFAULT;
      maximumSingleMessageSize = MAX_SINGLE_MSG_SEGMENT_SIZE_7BIT;
      maximumMultipartMessageSegmentSize = MAX_MULTIPART_MSG_SEGMENT_SIZE_7BIT;
    } else {
      byteSingleMessage = messageBody.getBytes("UTF-16BE");
      alphabet = Alphabet.ALPHA_UCS2;
      maximumSingleMessageSize = MAX_SINGLE_MSG_SEGMENT_SIZE_UCS2;
      maximumMultipartMessageSegmentSize = MAX_MULTIPART_MSG_SEGMENT_SIZE_UCS2;
    }

    // check if message needs splitting and set required sending parameters
    byte[][] byteMessagesArray = null;
    ESMClass esmClass = null;
    if (messageBody.length() > maximumSingleMessageSize) {
      // split message according to the maximum length of a segment
      byteMessagesArray = splitUnicodeMessage(byteSingleMessage, maximumMultipartMessageSegmentSize);
      // set UDHI so PDU will decode the header
      esmClass = new ESMClass(MessageMode.DEFAULT, MessageType.DEFAULT, GSMSpecificFeature.UDHI);
    } else {
      byteMessagesArray = new byte[][] { byteSingleMessage };
      esmClass = new ESMClass();
    }

    System.out.println("Sending message " + messageBody);
    System.out.printf("Message is %d characters long and will be sent as %d messages with params: %s %s ",
        messageBody.length(), byteMessagesArray.length, alphabet, messageClass);
    System.out.println();

    // submit all messages
    for (int i = 0; i < byteMessagesArray.length; i++) {
      String messageId = submitMessage(session, byteMessagesArray[i], sourceMsisdn, destinationMsisdn,
          messageClass, alphabet, esmClass);
      System.out.println("Message submitted, message_id is " + messageId);
    }

    System.out.println("Entering listening mode. Press enter to finish...");

    try {
      System.in.read();
    } catch (IOException e) {
      e.printStackTrace();
    }

    session.unbindAndClose();
  }
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

     *
     * @return the {@link SMPPSession}.
     * @throws IOException if the creation of new session failed.
     */
    private SMPPSession newSession() throws IOException {
        SMPPSession tmpSession = new SMPPSession(remoteIpAddress, remotePort, bindParam);
        tmpSession.addSessionStateListener(new SessionStateListenerImpl());
        return tmpSession;
    }
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

    }
   
    private SMPPSession createSession() throws IOException {
        LOG.debug("Connecting to: " + getEndpoint().getConnectionString() + "...");
       
        SMPPSession session = createSMPPSession();
        session.setEnquireLinkTimer(this.configuration.getEnquireLinkTimer());
        session.setTransactionTimer(this.configuration.getTransactionTimer());
        session.addSessionStateListener(internalSessionStateListener);
        session.connectAndBind(
                this.configuration.getHost(),
                this.configuration.getPort(),
                new BindParameter(
                        BindType.BIND_TX,
                        this.configuration.getSystemId(),
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

     * Factory method to easily instantiate a mock SMPPSession
     *
     * @return the SMPPSession
     */
    SMPPSession createSMPPSession() {
        return new SMPPSession(new SynchronizedPDUSender(new DefaultPDUSender(
                new DefaultComposer())), new DefaultPDUReader(), SmppConnectionFactory
                .getInstance(configuration));
    }
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

    private SmppConfiguration config = new SmppConfiguration();
    private AbstractSmppCommand command;
   
    @Before
    public void setUp() {
        session = new SMPPSession();
        config = new SmppConfiguration();
       
        command = new AbstractSmppCommand(session, config) {
            @Override
            public void execute(Exchange exchange) throws SmppException {
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

        assertSame(configuration, binding.getConfiguration());
    }
   
    @Test
    public void createSmppSubmitSmCommand() {
        SMPPSession session = new SMPPSession();
        Exchange exchange = new DefaultExchange(new DefaultCamelContext());
       
        SmppCommand command = binding.createSmppCommand(session, exchange);
       
        assertTrue(command instanceof SmppSubmitSmCommand);
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

        assertTrue(command instanceof SmppSubmitSmCommand);
    }
   
    @Test
    public void createSmppSubmitMultiCommand() {
        SMPPSession session = new SMPPSession();
        Exchange exchange = new DefaultExchange(new DefaultCamelContext());
        exchange.getIn().setHeader(SmppConstants.COMMAND, "SubmitMulti");
       
        SmppCommand command = binding.createSmppCommand(session, exchange);
       
View Full Code Here

Examples of org.jsmpp.session.SMPPSession

        assertTrue(command instanceof SmppSubmitMultiCommand);
    }
   
    @Test
    public void createSmppDataSmCommand() {
        SMPPSession session = new SMPPSession();
        Exchange exchange = new DefaultExchange(new DefaultCamelContext());
        exchange.getIn().setHeader(SmppConstants.COMMAND, "DataSm");
       
        SmppCommand command = binding.createSmppCommand(session, exchange);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.