class Echo implements Runnable {
    private static final Logger Log = LoggerFactory.getLogger(Echo.class);
    DatagramSocket socket = null;
    byte password[] = null;
    List<DatagramListener> listeners = new ArrayList<>();
    boolean enabled = true;

    public Echo(int port) throws UnknownHostException, SocketException {
        this.socket = new DatagramSocket(port, InetAddress.getByName("0.0.0.0"));
    }

    @Override
    public void run() {<FILL_FUNCTION_BODY>}

    public void cancel() {
        this.enabled = false;
        socket.close();
    }
}

        try {
            //System.out.println("Listening for ECHO: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort());
            while (true) {

                DatagramPacket packet = new DatagramPacket(new byte[8], 8);

                socket.receive(packet);

                System.out.println("ECHO Packet Received in: " + socket.getLocalAddress().getHostAddress() + ":" + socket.getLocalPort() + " From: " + packet.getAddress().getHostAddress() + ":" + packet.getPort());

                for (DatagramListener listener : listeners) {
                    try {
                        listener.datagramReceived(packet);
                    } catch (Exception e) {
                        Log.warn("An exception occurred while dispatching a 'datagramReceived' event!", e);
                    }
                }

                packet.setAddress(packet.getAddress());
                packet.setPort(packet.getPort());
                if (!Arrays.equals(packet.getData(), password))
                    for (int i = 0; i < 3; i++)
                        socket.send(packet);
            }
        } catch (IOException ioe) {
            if (enabled) {
            }
        }
    
<no_super_class>