public void connect(final IAsyncResultHandler<ILdapResult> handler) {
            try {
                connection = LDAPConnectionFactory.build(socketFactory, config);
                BindResult bindResponse = connection.bind(config.getBindDn(), config.getBindPassword());
                evalBindReturn(bindResponse.getResultCode(), bindResponse.getDiagnosticMessage(), null, handler);
            } catch (LDAPException e) {
                evalBindReturn(e.getResultCode(), e.getMessage(), e, handler);
            } catch (Exception e) {
                LDAPConnectionFactory.releaseDefunct(connection);
                handler.handle(AsyncResultImpl.<ILdapResult>create(e));
            }
        }
@author Marc Savy {@literal <msavy@redhat.com>}
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultLdapClientConnection.java