Fires a frame received event ({@link KNXListener#frameReceived(FrameEvent)}) for the supplied EMI
<code>frame</code>.

@param frame the EMI1/EMI2/cEMI L-data frame to generate the event for
@throws KNXFormatException on error creating cEMI message
768627
private void fireFrameReceived(final KnxTunnelEmi emiType, final byte[] frame) throws KNXFormatException
	{
		logger.debug("received {} frame {}", emiType, DataUnitBuilder.toHex(frame, ""));
		final FrameEvent fe = emiType == KnxTunnelEmi.CEmi
				? new FrameEvent(this, CEMIFactory.create(frame, 0, frame.length)) : new FrameEvent(this, frame);
		listeners.fire(l -> l.frameReceived(fe));
	}
1246085
protected void fireEvent(SerialPortEventTypes eventType) {
        executor.submit(new Runnable() {
            @Override
            public void run() {
                for (SerialPortEventListener listener : eventListeners) {
                    listener.serialEvent(new SerialPortEvent(eventType));
                }

            }
        });
    }
1371131
def send(self, encoded_frame):
        
        if self.socket is not None:
            try:
                with self.__socket_semaphore:
                    self.socket.sendall(encoded_frame)
            except Exception:
                _, e, _ = sys.exc_info()
                log.error("Error sending frame", exc_info=1)
                raise e
        else:
            raise exception.NotConnectedException()
1035586
public StompFrame decode(ChannelBuffer buffer) throws Exception {
        FrameHeader header = decodeHeader( buffer );

        if (header == null) {
            return null;
        }

        int len = header.getContentLength();

        ChannelBuffer content = null;

        if (len <= 0) {
            content = readUntilNull( buffer );
        } else {
            content = readUntil( buffer, len );
        }

        StompFrame frame = null;

        if (content != null) {
            if (header.isContentFrame()) {
                frame = new StompContentFrame( header, content );
            } else {
                frame = new StompControlFrame( header );
            }
        }

        return frame;
    }
813849
public void setFrame(java.lang.String frame) {
        getStateHelper().put(PropertyKeys.frame, frame);
        handleAttribute("frame", frame);
    }
957072
public void send(CEMI frame, BlockingMode mode) throws KNXTimeoutException,
		KNXConnectionClosedException
	{
		if (layer == BUSMONITOR_LAYER)
			throw new KNXIllegalStateException("send not permitted in busmonitor mode");
		if (!(frame instanceof CEMILData))
			throw new KNXIllegalArgumentException("unsupported cEMI type");
		super.send(frame, mode);
	}
1284030
@Override
    public void doExecute(TestContext context) {
        try {
            Message receivedMessage;
            String selector = MessageSelectorBuilder.build(messageSelector, messageSelectorMap, context);

            //receive message either selected or plain with message receiver
            if (StringUtils.hasText(selector)) {
                receivedMessage = receiveSelected(context, selector);
            } else {
                receivedMessage = receive(context);
            }

            if (receivedMessage == null) {
                throw new CitrusRuntimeException("Failed to receive message - message is not available");
            }

            //validate the message
            validateMessage(receivedMessage, context);
        } catch (IOException e) {
            throw new CitrusRuntimeException(e);
        }
    }
1167843
@Override
	public void send(final CEMI frame, final BlockingMode mode) throws KNXConnectionClosedException
	{
		if (frame.getMessageCode() != CEMILData.MC_LDATA_IND)
			throw new KNXIllegalArgumentException("cEMI frame is not an L-Data.ind");
		try {
			if (loopbackEnabled) {
				synchronized (loopbackFrames) {
					loopbackFrames.add((CEMILData) frame);
				}
				logger.trace("add to multicast loopback frame buffer: {}", frame);
			}
			// filter IP system broadcasts and always send them unsecured
			if (RoutingSystemBroadcast.isSystemBroadcast(frame)) {
				final byte[] buf = PacketHelper.toPacket(new RoutingSystemBroadcast(frame));
				final DatagramPacket p = new DatagramPacket(buf, buf.length, systemBroadcast, DEFAULT_PORT);
				if (sysBcastSocket != null)
					sysBcastSocket.send(p);
				else
					socket.send(p);
			}
			else
				super.send(frame, NonBlocking);
			// we always succeed...
			setState(OK);
		}
		catch (final IOException e) {
			close(CloseEvent.INTERNAL, "communication failure", LogLevel.ERROR, e);
			throw new KNXConnectionClosedException("connection closed (" + e.getMessage() + ")");
		}
		catch (final KNXTimeoutException ignore) {}
		catch (final InterruptedException e) {
			Thread.currentThread().interrupt();
		}
	}
823554
private void fireOnDeleteExchange(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onDeleteExchange(e);
        }
    }
1193349
public function sentFrame(Frame $frame)
    {
        foreach ($this->observers as $item) {
            $item->sentFrame($frame);
        }
    }
1320738
@Override
    public synchronized void addChainEventListener(ChainEventListener cel, String chainName) throws InvalidChainNameException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "addChainEventListener: chain=" + chainName + " listener=" + cel);
        }
        ChainDataImpl chainData = null;

        if (null == chainName) {
            InvalidChainNameException e = new InvalidChainNameException("Unable to register a listener for a chain with null name");
            //Race condition can occur where chain is stopped before we register the listener, no need to FFDC
            //FFDCFilter.processException(e, getClass().getName() + ".addChainEventListener", "2910", this, new Object[] { chainName, this });
            throw e;
        }

        // Handle a listener registering for events from all chains.
        if (chainName.equals(ChainEventListener.ALL_CHAINS)) {
            for (ChainData chain : this.chainDataMap.values()) {
                ((ChainDataImpl) chain).addChainEventListener(cel);
            }
            this.globalChainEventListeners.add(cel);
        } else {
            // Extract the chain config from the framework.
            chainData = this.chainDataMap.get(chainName);
            // Verify the chain config is in the framework
            if (null == chainData) {
                InvalidChainNameException e = new InvalidChainNameException("Unable to register listener for unknown chain config, " + chainName);
                //Race condition can occur where chain is stopped before we register the listener, no need to FFDC
                //FFDCFilter.processException(e, getClass().getName() + ".addChainEventListener", "2910", this, new Object[] { chainName, this });
                throw e;
            }
            chainData.addChainEventListener(cel);
        }
    }
1097840
protected void fireSegmentChanged(RoadSegment segment) {
		if (this.listeners != null && isEventFirable()) {
			for (final RoadNetworkListener listener : this.listeners) {
				listener.onRoadSegmentChanged(this, segment);
			}
		}
	}
294934
@Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable exception) throws Exception {
    if (exception instanceof FrameDecodingException) {
      int streamId = ((FrameDecodingException) exception).streamId;
      LOG.debug("[{}] Error while decoding response on stream id {}", logPrefix, streamId);
      if (streamId >= 0) {
        // We know which request matches the failing response, fail that one only
        ResponseCallback responseCallback = inFlight.get(streamId);
        if (responseCallback != null) {
          try {
            responseCallback.onFailure(exception.getCause());
          } catch (Throwable t) {
            Loggers.warnWithException(
                LOG, "[{}] Unexpected error while invoking failure handler", logPrefix, t);
          }
        }
        release(streamId, ctx);
      } else {
        Loggers.warnWithException(
            LOG,
            "[{}] Unexpected error while decoding incoming event frame",
            logPrefix,
            exception.getCause());
      }
    } else {
      // Otherwise fail all pending requests
      abortAllInFlight(
          (exception instanceof HeartbeatException)
              ? (HeartbeatException) exception
              : new ClosedConnectionException("Unexpected error on channel", exception));
      ctx.close();
    }
  }
1079913
def dispatch(self, frame):
        '''
        
        '''
        if frame.type() == HeartbeatFrame.type():
            self.send_heartbeat()

        elif frame.type() == MethodFrame.type():
            if frame.class_id == 10:
                cb = self._method_map.get(frame.method_id)
                if cb:
                    method = self.clear_synchronous_cb(cb)
                    method(frame)
                else:
                    raise Channel.InvalidMethod(
                        "unsupported method %d on channel %d",
                        frame.method_id, self.channel_id)
            else:
                raise Channel.InvalidClass(
                    "class %d is not supported on channel %d",
                    frame.class_id, self.channel_id)

        else:
            raise Frame.InvalidFrameType(
                "frame type %d is not supported on channel %d",
                frame.type(), self.channel_id)
1105239
@Override
	public void send(final CEMI frame, final BlockingMode mode)
		throws KNXTimeoutException, KNXConnectionClosedException, InterruptedException
	{
		if (layer == BusMonitorLayer)
			throw new IllegalStateException("send not permitted in busmonitor mode");
		if (!(frame instanceof CEMILData))
			throw new KNXIllegalArgumentException("unsupported cEMI type " + frame.getClass());
		super.send(frame, mode);
	}
679899
private void fireFrameType(final CEMI frame, final int type)
	{
		final FrameEvent e = new FrameEvent(this, frame);
		final Consumer<? super TransportListener> c;
		if (type == 0)
			c = l -> l.broadcast(e);
		else if (type == 1)
			c = l -> l.group(e);
		else if (type == 2)
			c = l -> l.dataIndividual(e);
		else if (type == 3)
			c = l -> l.dataConnected(e);
		else
			return;
		listeners.fire(c);
	}
1276138
private void createMonitor(LinkListener l) throws KNXException
	{
		final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium");
		if (options.containsKey("serial")) {
			final String p = (String) options.get("serial");
			try {
				m = new KNXNetworkMonitorFT12(Integer.parseInt(p), medium);
			}
			catch (final NumberFormatException e) {
				m = new KNXNetworkMonitorFT12(p, medium);
			}
		}
		else {
			// create local and remote socket address for monitor link
			final InetSocketAddress local = createLocalSocket((InetAddress) options
				.get("localhost"), (Integer) options.get("localport"));
			final InetSocketAddress host = new InetSocketAddress((InetAddress) options
				.get("host"), ((Integer) options.get("port")).intValue());
			// create the monitor link, based on the KNXnet/IP protocol
			// specify whether network address translation shall be used,
			// and tell the physical medium of the KNX network
			m = new KNXNetworkMonitorIP(local, host, options.containsKey("nat"), medium);
		}
		// add the log writer for monitor log events
		LogManager.getManager().addWriter(m.getName(), w);
		// on console we want to have all possible information, so enable
		// decoding of a received raw frame by the monitor link
		m.setDecodeRawFrames(true);
		// listen to monitor link events
		m.addMonitorListener(l);
		// we always need a link closed notification (even with user supplied listener)
		m.addMonitorListener(new LinkListener() {
			public void indication(FrameEvent e)
			{}

			public void linkClosed(CloseEvent e)
			{
				System.out.println("network monitor exit, " + e.getReason());
				synchronized (NetworkMonitor.this) {
					NetworkMonitor.this.notify();
				}
			}
		});
	}