Not sure why it would be doing that. You're absolutely right in saying the API indictates that the getServerName call should return the IP address or DNS name up to, but not including the colon (":") and port number.
So now you know you can't trust it to return only that part of the value. You can't control that aspect of your environment, but you can control how you perform the compare against the value in your xml file.
I'd probably use the String.indexOf fuction to see if it contained a colon (...after I checked to see if was null to avoid a nasty null pointer exception in the unlikely event that it was null).
If a value greater than -1 comes back (integer), then it contains a colon so it must have the port appended to it. Using that index, I would substring the servername from the beginning of the
string to that index and use that for my comparison.
Ideally you wouldn't need to do this, but real life and applications are rarely ideal.
Good Luck!