@Override
    public byte[] getData(Packet packet) {
        EthernetPacket ethernetPacket = (EthernetPacket) packet;
        IpV4Packet ipv4Packet = (IpV4Packet) ethernetPacket.getPayload();
        UdpPacket udpPacket = (UdpPacket) ipv4Packet.getPayload();
        if(udpPacket.getPayload() instanceof UnknownPacket) {
            UnknownPacket unknownPacket = (UnknownPacket) udpPacket.getPayload();
            return unknownPacket.getRawData();
        }
        return new byte[0];
    }
Little helper to automatically unwrap UDP packets to only
pass along the payload and not the raw Ethernet packet.
plc4j/utils/pcap-shared/src/main/java/org/apache/plc4x/java/utils/pcap/netty/handlers/UdpIpPacketHandler.java