Refactors master HA URI to make structure more clear
Adds two cancellation points in SwitchToSlave
Adds defensive check for switching to slave for ourselves as master

Also adds a catch clause around the get() for the Future of the
 task switching, when there is the need for cancellation
Adds a test for the added check