Ejemplo n.º 1
0
  /**
   * Processes a packet through the installed packet collectors and listeners and letting them
   * examine the packet to see if they are a match with the filter.
   *
   * @param packet the packet to process.
   */
  public void processPacket(Packet packet) {
    if (packet == null) {
      return;
    }

    // Loop through all collectors and notify the appropriate ones.
    for (PacketCollector collector : getPacketCollectors()) {
      collector.processPacket(packet);
    }

    if (DEBUG_ENABLED) {
      System.out.println("[RECV]: " + packet.toXML());
    }

    // Deliver the incoming packet to listeners.
    for (ListenerWrapper listenerWrapper : recvListeners.values()) {
      try {
        listenerWrapper.notifyListener(packet);
      } catch (NotConnectedException e) {
        e.printStackTrace();
      }
    }
  }
Ejemplo n.º 2
0
 /**
  * Process all packet listeners for sending packets.
  *
  * @param packet the packet to process.
  */
 protected void firePacketSendingListeners(Packet packet) {
   // Notify the listeners of the new sent packet
   for (ListenerWrapper listenerWrapper : sendListeners.values()) {
     listenerWrapper.notifyListener(packet);
   }
 }
Ejemplo n.º 3
0
 protected void firePacketSendingListeners(Packet packet) {
   for (ListenerWrapper listenerWrapper : this.sendListeners.values()) {
     listenerWrapper.notifyListener(packet);
   }
 }