Shuffle gateway logic around for improved reconnecting.

Fixes #957
Changelog re #957
Travis no longer supports Python 2.5

Now I'm EVEN MORE glad my default dev venv is 2.5 based...
Fix bug where _pty_size() returns unreasonable rows/cols in Emacs
Changelog re #956, fixes #956
Cut 1.5.5