/** @param init */
  private void handleChannelInit(ChannelInit init) {
    try {
      init.go();
    } catch (AppiaEventException e) {
      e.printStackTrace();
    }
    channel = init.getChannel();

    try {
      // sends this event to open a socket in the layer that is used has
      // perfect
      // point to point
      // channels or unreliable point to point channels.
      RegisterSocketEvent rse = new RegisterSocketEvent(channel, Direction.DOWN, this);
      rse.port = ((InetSocketAddress) processes.getSelfProcess().getSocketAddress()).getPort();
      rse.localHost =
          ((InetSocketAddress) processes.getSelfProcess().getSocketAddress()).getAddress();
      rse.go();
      ProcessInitEvent processInit = new ProcessInitEvent(channel, Direction.DOWN, this);
      processInit.setProcessSet(processes);
      processInit.go();
    } catch (AppiaEventException e1) {
      e1.printStackTrace();
    }
    System.out.println("Channel is open.");
  }
Exemple #2
0
 /*
  * handles ChannelInit
  * @param init
  */
 private void handleChannelInit(ChannelInit init) {
   try {
     init.go();
   } catch (AppiaEventException e) {
     e.printStackTrace();
   }
   time = init.getChannel().getTimeProvider();
 }
 /** @param init */
 private void handleChannelInit(ChannelInit init) {
   channels.put(init.getChannel(), null);
   try {
     init.go();
   } catch (AppiaEventException e) {
     e.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();
    }
  }
  private void handleChannelInit(ChannelInit init) {
    if (mainchannel == null) {
      mainchannel = init.getChannel();
      debug("mainchannel initiated");
      try {
        pp2pinit.start();
      } catch (AppiaDuplicatedSessionsException ex) {
        ex.printStackTrace();
      }
    } else {
      if (init.getChannel() == pp2pinit) {
        pp2pchannel = init.getChannel();
      }
    }

    try {
      init.go();
    } catch (AppiaEventException ex) {
      ex.printStackTrace();
    }
  }