Implemented correct random weight algorigthm. XMPPConnection now tries more then just one possible HostAddress to connect to.

Added testcases for random weight algorithm.