class UDPConfigHandler extends Handler<ExtensionServiceMessage> {

    boolean isConfiguredToSend(Map outgoing) {
        if (outgoing == null || !(outgoing.get("targetAddress") instanceof String) ||
                !(outgoing.get("targetPort") instanceof Integer)) {
            return false;
        }
        int port = (Integer) outgoing.get("targetPort");
        String addr = (String) outgoing.get("targetAddress");
        if (port < 0 || port > 65535) {
            return false;
        }
        try {
            InetAddress.getByName(addr);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

}