예제 #1
0
 /**
  * Establishes the session with the remote host.
  *
  * @param connectionHandle - {@link ConnectionHandle} associated with the remote host.
  * @param username - the username
  * @param password - password matching the username
  * @param bmcKey - the key that should be provided if the two-key authentication is enabled, null
  *     otherwise.
  * @throws ConnectionException when connection is in the state that does not allow to perform this
  *     operation.
  * @throws Exception when sending message to the managed system or initializing one of the
  *     cipherSuite's algorithms fails
  */
 public void openSession(
     ConnectionHandle connectionHandle, String username, String password, byte[] bmcKey)
     throws Exception {
   int tries = 0;
   boolean succeded = false;
   while (tries <= retries && !succeded) {
     try {
       ++tries;
       connectionManager.startSession(
           connectionHandle.getHandle(),
           connectionHandle.getCipherSuite(),
           connectionHandle.getPrivilegeLevel(),
           username,
           password,
           bmcKey);
       succeded = true;
     } catch (Exception e) {
       logger.warn("Failed to receive answer, cause:", e);
       if (tries > retries) {
         throw e;
       }
     }
   }
   return;
 }