@Override
    boolean handle(DatagramPacket packet) {
        // Relay Destination
        if (c++ < 100) { // 100 packets are enough to discover relay address
            this.setHost(packet.getAddress());
            this.setPort(packet.getPort());
            return true;
        } else {
            c = 1000; // Prevents long overflow
            // Check Source Address. If it's different, discard packet.
            return this.getHost().equals(packet.getAddress());
        }
    }
Default Channel Constructor

@param dataSocket datasocket to used to send and receive packets
@param host       default destination host for received packets
@param port       default destination port for received packets
xmppserver/src/main/java/org/jivesoftware/openfire/mediaproxy/DynamicAddressChannel.java