Fixes #4464: correct the logic for connection release and the logic to get the capabilities of the server
Merge pull request #9 from fanf/big_4464/correct_connection_releasing_of_test_in_memory_ldap_server

Fixes #4464: correct the logic for connection release and the logic to get the capabilities of the server