Test Net::LDAP#open behavior
Add failing test for Net::LDAP#open with nested queries

The nested query should match "user2", but with Net::LDAP#open, we see:

  <"user3"> expected but was <"user2">.

And likewise with the outer search:

  <["user1", "user2"]> expected but was <["user1", "user3"]>.

What's happening is that the nested query is being sent after the server
has already sent more data to be read for the outer search, so when the
inner search reads, it gets that result. And when it comes time for the
outer search to handle the second results, it gets reads the next result
off the wire, the result of the inner search.

I was also able to get an infinite loop just by *always* performing an
inner search instead of only searching on the first result.
Merge branch 'master' into open-integration-tests
Accept message_id as param to write
Pull queued messages first, queue messages unless ID matches
Include message ID in event payload
Fix message_id in test
Extract queued_read(message_id) method
Extract message_queue accessor, documentation, cleanup
Clear search's message queue, instrument unread messages

Shouldn't have unread messages but provide a way to measure it anyway.
Fix size option for ldap.search method

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fix test for ldap.search return codes

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Remove unnecessary assert in ldap.search return code test

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Avoid using magic number in ldap.search

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Avoid magic number in success case of ldap search

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Merge pull request #138 from ruby-ldap/read-queue-by-message_id

Prioritize reads from queue by message ID
Add additional integration test for ldap.search with result

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Merge branch 'master' into open-integration-tests

Conflicts:
	lib/net/ldap/connection.rb
	test/test_ldap_connection.rb
Add explanatory comment
Fix test_search_with_size case

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>