Added connect method which accepts a URI see #164.

I have done my best to match the prevailing style while keeping the code fairly terse.

Looking forward to feedback as there are a few changes here.