Ejemplo n.º 1
0
  @Override
  public void start() throws SmppChannelException {
    if (isDestroyed()) {
      throw new SmppChannelException("Unable to start: server is destroyed");
    }
    try {
      ChannelFuture f = this.serverBootstrap.bind(new InetSocketAddress(configuration.getPort()));

      // wait until the connection is made successfully
      boolean timeout = !f.await(configuration.getBindTimeout());

      if (timeout || !f.isSuccess())
        throw new SmppChannelException(
            "Can't bind to port "
                + configuration.getPort()
                + " after "
                + configuration.getBindTimeout()
                + " milliseconds");

      logger.info("{} started on SMPP port [{}]", configuration.getName(), configuration.getPort());
      serverChannel = f.channel();
    } catch (ChannelException e) {
      throw new SmppChannelException(e.getMessage(), e);
    } catch (InterruptedException e) {
      throw new SmppChannelException(e.getMessage(), e);
    }
  }
Ejemplo n.º 2
0
 public void connect() {
   try {
     channel.connect("TOTAL_TOKEN_DEMO_GROUP");
   } catch (ChannelException e) {
     e.printStackTrace();
   }
   receiverThread = new ReceiverThread();
   receiverThread.start();
   Address a = channel.getAddress();
   if (a != null) setTitle(a.toString());
   else setTitle("Not connected");
   control.connected();
 }
Ejemplo n.º 3
0
  public TotalTokenDemo(String props) {
    super();
    tabbedPane = new JTabbedPane();
    control = new ControlPanel();
    channelProperties = props;

    try {
      channel = new JChannel(channelProperties);
    } catch (ChannelException e) {
      System.err.println("Could not create channel, exiting ....");
      e.printStackTrace(System.err);
    }

    addPanel("Control", control);
    getContentPane().add(tabbedPane);
    connect();
  }