src/main/java/org/jivesoftware/smack/util/StringUtils.java
public static String parseServer(String XMPPAddress) {
        if (XMPPAddress == null) {
            return null;
        }
        int atIndex = XMPPAddress.lastIndexOf("@");
        // If the String ends with '@', return the empty string.
        if (atIndex + 1 > XMPPAddress.length()) {
            return "";
        }
        int slashIndex = XMPPAddress.indexOf("/");
        if (slashIndex > 0 && slashIndex > atIndex) {
            return XMPPAddress.substring(atIndex + 1, slashIndex);
        } else {
            return XMPPAddress.substring(atIndex + 1);
        }
    }
public static String parseServer(String XMPPAddress) {
        if (XMPPAddress == null) {
            return null;
        }
        int atIndex = XMPPAddress.lastIndexOf("@");
        // If the String ends with '@', return the empty string.
        if (atIndex + 1 > XMPPAddress.length()) {
            return "";
        }
        int slashIndex = XMPPAddress.indexOf("/");
        if (slashIndex > 0 && slashIndex > atIndex) {
            return XMPPAddress.substring(atIndex + 1, slashIndex);
        } else {
            return XMPPAddress.substring(atIndex + 1);
        }
    }
Returns the server portion of a XMPP address. For example, for the
address "matt@jivesoftware.com/Smack", "jivesoftware.com" would be
returned. If no server is present in the address, the empty string will
be returned.

@param XMPPAddress
the XMPP address.
@return the server portion of the XMPP address.