private static String encode(Map<String, SrvRecord> internalDNS) {
        if (internalDNS == null) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        for (String key : internalDNS.keySet()) {
            if (!sb.isEmpty()) {
                sb.append(',');
            }
            sb.append('{').append(key).append(',');
            sb.append(internalDNS.get(key).getHostname()).append(':');
            sb.append(internalDNS.get(key).getPort()).append('}');
        }
        return sb.toString();
    }
Sets the internal DNS that allows to specify target IP addresses and ports
to use for domains. The internal DNS will be checked up before performing an
actual DNS SRV lookup.

@param dnsOverride the internal DNS that allows to specify target IP addresses and ports
       to use for domains.
xmppserver/src/main/java/org/jivesoftware/openfire/net/DNSUtil.java