resp.setLdapResult( new LdapResultImpl( resp ) );
    public Object handle( ClientKey key, Object request )    {        BindRequest req = ( BindRequest ) request;        BindResponse resp = new BindResponseImpl( req.getMessageId() );        if ( ! req.isSimple() )        {            resp.setLdapResult( new LdapResultImpl( resp ) );            resp.getLdapResult().setResultCode( ResultCodeEnum.AUTHMETHODNOTSUPPORTED );            resp.getLdapResult().setErrorMessage( "Only simple binds currently supported" );            return resp;        }        String dn = req.getName();        byte[] creds = req.getCredentials();        Hashtable env = SessionRegistry.getSingleton( null ).getEnvironment();        InitialContext ictx;        try        {            ictx = new InitialContext( env );        }        catch( NamingException e )        {            resp.setLdapResult( new LdapResultImpl( resp ) );            resp.getLdapResult().setResultCode( ResultCodeEnum.OTHER );            String msg = "Bind failure:\n" + ExceptionUtils.getStackTrace( e );            msg += "\n\nBindRequest = \n" + req.toString();            resp.getLdapResult().setErrorMessage( msg );            return resp;        }        SessionRegistry.getSingleton( null ).put( key, ictx );        resp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );        resp.getLdapResult().setMatchedDn( req.getName() );        return resp;    }