secureArgsList.portArg.addValue(Integer.toString(port));
// We already know if SSL or StartTLS can be used. If we cannot
// use them we will not propose them in the connection parameters
// and if none of them can be used we will just not ask for the
// protocol to be used.
LDAPConnectionConsoleInteraction ci =
new LDAPConnectionConsoleInteraction(
this, argParser.getSecureArgsList());
try {
ci.run(true, false);
bindDn = ci.getBindDN();
bindPwd = ci.getBindPassword();
LDAPManagementContextFactory factory =
new LDAPManagementContextFactory(alwaysSSL);
ctx = factory.getManagementContext(this, ci);
interactiveTrustManager = ci.getTrustManager();
controlInfo.setTrustManager(interactiveTrustManager);
useInteractiveTrustManager = true;
} catch (ArgumentException e) {
println(e.getMessageObject());
return ErrorReturnCode.USER_CANCELLED_OR_DATA_ERROR.getReturnCode();