*/
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) {