Fixed reconnecting a replica or sharded client

https://jira.mongodb.org/browse/RUBY-579