/** @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."); }
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(); } }