} else if (password != null) {
String[] methods = connection.getRemainingAuthMethods(userName);
authenticated = false;
for (int i = 0; i < methods.length; i++) {
if ("password".equals(methods[i])) {
authenticated = connection.authenticateWithPassword(userName, password);
} else if ("keyboard-interactive".equals(methods[i])) {
final String p = password;
authenticated = connection.authenticateWithKeyboardInteractive(userName, new InteractiveCallback() {
public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo) throws Exception {
String[] reply = new String[numPrompts];