NEXUS-5849: Wrong condition to detect address element

Original code had a bug, an exclamation mark that
negated condition to recognize remote server.

This change fixed that, but also improves code a
bit making it more resilient to empty or null
address tags, and also comparing test against
lowered case.