Connection timeout implementation

Tested on OSX and latest Ubuntu, this implements connection timeouts following the method explained at http://stackoverflow.com/questions/9853516/set-socket-timeout-in-ruby-via-so-rcvtimeo-socket-option/12111120#12111120
I'm not sure about IPv6 compatibility, given the comments at http://www.mikeperham.com/2009/03/15/socket-timeouts-in-ruby/