Factor login out of runSocket, runSocks