private void handleSendEvent(SendEvent conf) {
    Message message = conf.getMessage();
    int id = message.popInt();

    System.out.println("[Message received: " + message.peekString() + "]");

    message.pushInt(id);

    DeliverEvent event = new DeliverEvent();
    event.setMessage(message);
    event.setDestProcess(processes.getOther());
    event.setSourceProcess(processes.getSelf());
    event.setChannel(conf.getChannel());
    event.setDir(Direction.DOWN);
    event.setSourceSession(this);

    try {
      event.init();
      event.go();
    } catch (AppiaEventException ex) {
      ex.printStackTrace();
    }
  }
  private void handleChannelInit(ChannelInit init) {
    try {
      init.go();
    } catch (AppiaEventException ex) {
      ex.printStackTrace();
    }

    try {
      RegisterSocketEvent rse = new RegisterSocketEvent(init.getChannel(), Direction.DOWN, this);

      InetSocketAddress address = processes.getSelf().getCompleteAddress();

      rse.port = address.getPort();
      rse.localHost = address.getAddress();

      rse.go();
    } catch (AppiaEventException e1) {
      e1.printStackTrace();
    }
  }