sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_PROP, DerefAliasesEnum.NEVERDEREFALIASES.getName() );
sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
    public void testSearchTimeLimit() throws NamingException    {        SearchControls controls = new SearchControls();        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );        controls.setDerefLinkFlag( false );        controls.setTimeLimit( 200 );        sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_PROP, DerefAliasesEnum.NEVERDEREFALIASES.getName() );        HashMap map = new HashMap();        NamingEnumeration list = sysRoot.search( "", "(ou=*)", controls );        SearchResultFilteringEnumeration srfe = ( SearchResultFilteringEnumeration ) list;        srfe.addResultFilter( new SearchResultFilter()        {            public boolean accept( Invocation invocation, SearchResult result, SearchControls controls )                throws NamingException            {                try                {                    Thread.sleep( 201 );                }                catch ( InterruptedException e )                {                    e.printStackTrace();                }                return true;            }        } );        try        {            while ( list.hasMore() )            {                SearchResult result = ( SearchResult ) list.next();                map.put( result.getName(), result.getAttributes() );            }            fail( "Should not get here due to a TimeLimitExceededException" );        }        catch ( LdapTimeLimitExceededException e )        {        }        assertEquals( "Expected number of results returned was incorrect", 1, map.size() );    }