Examples of Expect


Examples of com.sun.grid.util.expect.Expect

     */
    public Set authenticate(final String username, final char[] password) throws LoginException {
       
        Set ret = null;
       
        Expect expect = new Expect(command);

        expect.add(new ExpectStringHandler("username: ", username.toCharArray()));
        expect.add(new ExpectPasswordHandler("password: ", password));
       
        PrincipalHandler principalHandler = new PrincipalHandler(username);       
        expect.add(principalHandler);
       
        ErrorHandler errorHandler = new ErrorHandler();
        expect.add(errorHandler);
       
        try {           
            int exitCode = expect.exec(60*1000);
           
            // exit codes are defined in juti.h (see auth_result_t)
            // 0 means success, 1 means invalid username of password,
            // 2 means error
            switch(exitCode) {
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.