code: @Override
      public void connectController(String host, int port) {
  
          try {
              if (host == null && port == -1) {
                  try {
                      this.controllerHost = this.defaultControllerHost;
                      this.controllerPort = this.defaultControllerPort;
  
                      client.connect(new InetSocketAddress(this.controllerHost, this.controllerPort));
                      this.prompt = this.prefix + "(local)" + Shell.CLI_POSTFIX;
                  } catch (IOException e) {
                      this.printLine(e.getMessage());
                  }
              } else {
                  this.controllerHost = host;
                  this.controllerPort = port;
  
                  client.connect(new InetSocketAddress(this.controllerHost, this.controllerPort));
                  this.prompt = this.prefix + "(" + host + ":" + port + ")" + Shell.CLI_POSTFIX;
              }
  
              Message incomingFirstMessage = this.client.run(null);
              String mesage = incomingFirstMessage.toString();
  
              this.printLine(mesage);
              if (mesage.contains(CONNECTED_AUTHENTICATING_MESSAGE)) {
                  username = this.console.readLine("Username:");
                  this.client.run(messageFactory.createMessage(username));
  
                  password = this.console.readLine("Password:", '*');
                  Message message = this.client.run(messageFactory.createMessage(password));
                  mesage = message.toString();
                  if (mesage.equals(CONNECTED_AUTHENTICATION_FAILED)) {
                      this.printLine(message.toString());
                      this.disconnectController();
                  }
              } else if (mesage.contains(CLOSING_CONNECTION_MESSAGE)) {
                  this.disconnectController();
              }
          } catch (Exception e) {
              this.printLine(e.getMessage());
          }
      }
docs: /*
  (non-Javadoc)
  
  @see org.restcomm.ss7.management.console.CommandContext#connectController (java.lang.String, int)