for (int i = 0; i < callbacks.length; i++){
if (callbacks[i] instanceof NameCallback){
NameCallback nameCall = (NameCallback) callbacks[i];
nameCall.setName(userName);
} else if (callbacks[i] instanceof PasswordCallback){
PasswordCallback passCall = (PasswordCallback) callbacks[i];
passCall.setPassword(password.toCharArray());
} else{
throw new UnsupportedCallbackException (callbacks[i],
"The CallBacks are unrecognized in class: "+getClass().getName());
}
}//for