Add TCP keepalive

Fixes issue #103 (on Linux devices)

Preferences don't include realtime updates to the current connection,
although that would be possible.
`sock` will always be `null` at this point. The socket is created by the `connector` thread in the concrete connection classes, and creation may be interrupted on subsequent executions of `connect()`. I think the best place would be to keep this in `AbstractConnection`, perhaps receiving a notification from the `connector` thread when it completes.