protected boolean canConnect(VDS vds) {
    // execute the connectivity and id uniqueness validation for VDS type hosts
    if (!getParameters().isPending()
        && !getParameters().isProvisioned()
        && Config.<Boolean>getValue(ConfigValues.InstallVds)) {
      try (final EngineSSHClient sshclient = getSSHClient()) {
        sshclient.connect();
        sshclient.authenticate();

        String hostUUID = getInstalledVdsIdIfExists(sshclient);
        if (hostUUID != null && vdsDao.getAllWithUniqueId(hostUUID).size() != 0) {
          return failValidation(EngineMessage.ACTION_TYPE_FAILED_VDS_WITH_SAME_UUID_EXIST);
        }

        return isValidGlusterPeer(sshclient, vds.getClusterId());
      } catch (AuthenticationException e) {
        log.error(
            "Failed to authenticate session with host '{}': {}", vds.getName(), e.getMessage());
        log.debug("Exception", e);
        return failValidation(EngineMessage.VDS_CANNOT_AUTHENTICATE_TO_SERVER);
      } catch (SecurityException e) {
        log.error(
            "Failed to connect to host '{}', fingerprint '{}': {}",
            vds.getName(),
            vds.getSshKeyFingerprint(),
            e.getMessage());
        log.debug("Exception", e);
        addValidationMessage(EngineMessage.VDS_SECURITY_CONNECTION_ERROR);
        addValidationMessageVariable("ErrorMessage", e.getMessage());
        return failValidation(EngineMessage.VDS_CANNOT_AUTHENTICATE_TO_SERVER);
      } catch (Exception e) {
        log.error("Failed to establish session with host '{}': {}", vds.getName(), e.getMessage());
        log.debug("Exception", e);

        return failValidation(EngineMessage.VDS_CANNOT_CONNECT_TO_SERVER);
      }
    }
    return true;
  }
  public EngineSSHClient getSSHClient() throws Exception {
    Long timeout =
        TimeUnit.SECONDS.toMillis(
            Config.<Integer>getValue(ConfigValues.ConnectToServerTimeoutInSeconds));

    EngineSSHClient sshclient = new EngineSSHClient();
    sshclient.setVds(getParameters().getvds());
    sshclient.setHardTimeout(timeout);
    sshclient.setSoftTimeout(timeout);
    sshclient.setPassword(getParameters().getPassword());
    switch (getParameters().getAuthMethod()) {
      case PublicKey:
        sshclient.useDefaultKeyPair();
        break;
      case Password:
        sshclient.setPassword(getParameters().getPassword());
        break;
      default:
        throw new Exception("Invalid authentication method value was sent to AddVdsCommand");
    }

    return sshclient;
  }