Prevent socket timeout being set to a non-numeric value.
Raise the error correctly when a connection cannot be established (#147)