Examples of BindFuture


Examples of org.apache.directory.ldap.client.api.future.BindFuture

            // Send another BindRequest
            BindRequest bindRequest = new BindRequest();
            bindRequest.setName( "uid=admin,ou=system" );
            bindRequest.setCredentials( "secret" );
           
            BindFuture bindFuture = connection.bindAsync( bindRequest );
           
            // Wait a bit to be sure the server is processing the bind request
            Thread.sleep( 200 );
           
            // It will take 1 seconds to bind, let's send another bind request : it should fail
            BindResponse response = connection.bind( "uid=admin,ou=system", "secret" );
           
            assertFalse( connection.isAuthenticated() );
            assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response.getLdapResult().getResultCode() );
           
            // Now get back the BindResponse
            try
            {
                BindResponse bindResponse = bindFuture.get( 2000, TimeUnit.MILLISECONDS );
               
                assertNotNull( bindResponse );
                assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
                assertTrue( connection.isAuthenticated() );
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.