Bringing @noric's ssh-keepalive up to date

Original PR: https://github.com/matschaffer/knife-solo/pull/288
Fixes #222.
Some tiny tweaks to make @noric's original patch work again.

This issue's affecting me, so if I can get this into 0.5.0, that'd be great.