Very carefully handle all of the different cases for servers and ports

1. mobile-server passed
2. running on device
3. running on simulator