Add support for local host and port binding

Add support for specifying a local host and port to bind to, before connecting.

This was implemented as per https://bugs.ruby-lang.org/issues/6617 and only works for Ruby 2.0 or later.