refactor connection establishment

reduces duplicated code, and makes it easier for future changes
to connection establishment because it's all in one place now
This method feels very similar to [`Net::LDAP#open`](https://github.com/ccutrer/ruby-net-ldap/blob/443fdb1fda855031d958a587dd6a2b272edb5b16/lib/net/ldap.rb#L648-L682).