Examples of SmppServerConnector


Examples of com.cloudhopper.smpp.channel.SmppServerConnector

       
        // set options for the server socket that are useful
        this.serverBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
       
        // we use the same default pipeline for all new channels - no need for a factory
        this.serverConnector = new SmppServerConnector(channels, this);
        this.serverBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_SERVER_CONNECTOR_NAME, this.serverConnector);
        // a shared timer used to make sure new channels are bound within X milliseconds
        this.bindTimer = new Timer(configuration.getName() + "-BindTimer0", true);
        // NOTE: this would permit us to customize the "transcoding" context for a server if needed
        this.transcoder = new DefaultPduTranscoder(new DefaultPduTranscoderContext());
View Full Code Here

Examples of com.cloudhopper.smpp.channel.SmppServerConnector

       
        // set options for the server socket that are useful
        this.serverBootstrap.setOption("reuseAddress", configuration.isReuseAddress());
       
        // we use the same default pipeline for all new channels - no need for a factory
        this.serverConnector = new SmppServerConnector(channels, this);
        this.serverBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_SERVER_CONNECTOR_NAME, this.serverConnector);
  // a shared instance of a timer for session writeTimeout timing
  this.writeTimeoutTimer = new org.jboss.netty.util.HashedWheelTimer();
        // a shared timer used to make sure new channels are bound within X milliseconds
        this.bindTimer = new Timer(configuration.getName() + "-BindTimer0", true);
View Full Code Here

Examples of org.mokai.connector.smpp.SmppServerConnector

    MockMessageProducer messageProducer = new MockMessageProducer();

    SmppServerConfiguration configuration = new SmppServerConfiguration();
    configuration.addUser("test", "test");

    SmppServerConnector connector = new SmppServerConnector(configuration);
    injectResource(messageProducer, connector);
    injectResource(buildConnectorContext("test"), connector);
    connector.configure();
    connector.doStart();

    // open connection and bind
    Connection connection = connect(4444);
    bind(connection, Connection.TRANSMITTER, "test", "test", null);

    SubmitSM submitSM = (SubmitSM) connection.newInstance(SMPPPacket.SUBMIT_SM);
    submitSM.setDestination(new Address(0, 0, "573001111111"));
    submitSM.setSource(new Address(0, 0, "3542"));
    submitSM.setMessageText("This is a test");

    SubmitSMResp response = (SubmitSMResp) connection.sendRequest(submitSM);
    Assert.assertNotNull(response);
    Assert.assertTrue(response.getMessageId() != null);

    Assert.assertEquals(messageProducer.messageCount(), 1);
    Message message = messageProducer.getMessage(0);
    Assert.assertNotNull(message);
    Assert.assertEquals(message.getProperty("to", String.class), "573001111111");
    Assert.assertEquals(message.getProperty("from", String.class), "3542");
    Assert.assertEquals(message.getProperty("text", String.class), "This is a test");

    connection.unbind();
    connection.closeLink();

    connector.doStop();
  }
View Full Code Here

Examples of org.mokai.connector.smpp.SmppServerConnector

    connector.doStop();
  }

  @Test
  public void shouldFailToBindIfBadSystemId() throws Exception {
    SmppServerConnector connector = new SmppServerConnector();
    connector.configure();
    connector.doStart();

    // open connection and bind
    Connection connection = connect(4444);

    BindResp bindResp = connection.bind(Connection.TRANSMITTER, "test", "test", null);
    Assert.assertNotNull(bindResp);
    Assert.assertEquals(bindResp.getCommandStatus(), Response.INVALID_SYSTEM_ID.getCommandStatus());

    connector.doStop();
  }
View Full Code Here

Examples of org.mokai.connector.smpp.SmppServerConnector

  @Test
  public void shouldFailToBindIfBadPassword() throws Exception {
    SmppServerConfiguration configuration = new SmppServerConfiguration();
    configuration.addUser("test", "test");

    SmppServerConnector connector = new SmppServerConnector(configuration);
    connector.configure();
    connector.doStart();

    Connection connection = connect(4444);
    BindResp bindResp = connection.bind(Connection.TRANSMITTER, "test", "other", null);
    Assert.assertNotNull(bindResp);
    Assert.assertEquals(bindResp.getCommandStatus(), Response.INVALID_PASSWORD.getCommandStatus());

    connector.doStop();
  }
View Full Code Here

Examples of org.mokai.connector.smpp.SmppServerConnector

  @Test
  public void shouldProduceDeliverSm() throws Exception {
    SmppServerConfiguration configuration = new SmppServerConfiguration();
    configuration.addUser("test", "test");

    final SmppServerConnector connector = new SmppServerConnector(configuration);
    injectResource(buildConnectorContext("test"), connector);
    connector.configure();
    connector.doStart();

    // open connection and bind
    Connection connection = connect(4444);
    bind(connection, Connection.TRANSMITTER, "test", "test", null);

    // send deliver_sm
    new Thread(new Runnable() {

      @Override
      public void run() {
        Message message = new Message();
        message.setProperty("to", "1111");
        message.setProperty("from", "2222");
        message.setProperty("text", "This is a test");

        try {
          connector.process(message);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

    }).start();

    SMPPPacket packet = connection.readNextPacket();
    Assert.assertNotNull(packet);
    Assert.assertEquals(packet.getCommandId(), SMPPPacket.DELIVER_SM);

    DeliverSM deliverSm = (DeliverSM) packet;
    Assert.assertEquals(deliverSm.getEsmClass(), (byte) 0);
    Assert.assertEquals(deliverSm.getSource().getAddress(), "2222");
    Assert.assertEquals(deliverSm.getDestination().getAddress(), "1111");
    Assert.assertEquals(deliverSm.getMessageText(), "This is a test");

    connector.doStop();
  }
View Full Code Here

Examples of org.mokai.connector.smpp.SmppServerConnector

  @Test
  public void shouldProduceDeliveryReceipt() throws Exception {
    SmppServerConfiguration configuration = new SmppServerConfiguration();
    configuration.addUser("test", "test");

    final SmppServerConnector connector = new SmppServerConnector(configuration);
    injectResource(buildConnectorContext("test"), connector);
    connector.configure();
    connector.doStart();

    // open connection and bind
    Connection connection = connect(4444);
    bind(connection, Connection.TRANSMITTER, "test", "test", null);

    final SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmm");
    final Date submitDate = sdf.parse("1201011023");
    final Date doneDate = sdf.parse("1201011048");

    // send deliver_sm
    new Thread(new Runnable() {

      @Override
      public void run() {
        Message message = new Message();

        message.setProperty("isDLR", true);
        message.setProperty("to", "1111");
        message.setProperty("from", "2222");
        message.setProperty("messageId", "12345");
        message.setProperty("submitted", 1);
        message.setProperty("submitDate", submitDate);
        message.setProperty("delivered", 1);
        message.setProperty("doneDate", doneDate);
        message.setProperty("finalStatus", "DELIVRD");

        try {
          connector.process(message);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
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.