public <T> T execute(Object object, Class<T> returnType) throws ClientGeneralException {
   initializeRequest();
   T returnObject =
       ucsmTransportWrapper.execute(serviceURI, postPayload((JAXBElement<?>) object), returnType);
   checkForResponseStatusErrors(returnObject);
   return returnObject;
 }
  private void attemptSessionRefresh() throws ClientGeneralException {
    try {
      writeLock();
      // write lock defence code
      LOGGER.debug("Attempt to refresh session for {}", hostAddress);
      if (isSessionValid()) {
        LOGGER.debug("Session is valid for {}. No need to refresh", hostAddress);
        return;
      }
      ComputeSessionCache cache = decryptAndRetrieveSessionCache();

      if (cache == null || cache.getHashKey() == null || !cache.getHashKey().equals(oneWayHash)) {
        encryptAndUpdateSessionCache(new ComputeSessionCache());
        return;
      }

      AaaRefresh aaaRefresh = new AaaRefresh();
      aaaRefresh.setInName(username);
      aaaRefresh.setInPassword(password);
      aaaRefresh.setCookie(cache.getSessionId());
      aaaRefresh.setInCookie(cache.getSessionId());

      Object response =
          ucsmTransportWrapper.execute(
              serviceURI, objectFactory.createAaaRefresh(aaaRefresh), Object.class);

      Assert.notNull(response, "Authentication Call resulted in Null Response");
      Assert.isTrue(
          response instanceof com.emc.cloud.platform.ucs.out.model.AaaRefresh,
          "Invalid Response Type!");

      com.emc.cloud.platform.ucs.out.model.AaaRefresh refreshResponse =
          (com.emc.cloud.platform.ucs.out.model.AaaRefresh) response;
      if (refreshResponse != null
          && refreshResponse.getOutCookie() != null
          && !refreshResponse.getOutCookie().isEmpty()) {
        LOGGER.info("Session has been refreshed");

        cache =
            new ComputeSessionCache(
                refreshResponse.getOutCookie(),
                System.currentTimeMillis(),
                parseNumber(refreshResponse.getOutRefreshPeriod()).longValue(),
                oneWayHash);
        encryptAndUpdateSessionCache(cache);

      } else {
        LOGGER.info("Session for {} cannot be refreshed", hostAddress);
        encryptAndUpdateSessionCache(new ComputeSessionCache());
      }

    } finally {
      writeUnlock();
    }
  }
  private void relogin() throws ClientGeneralException {
    try {
      writeLock();
      LOGGER.info("Attempt to login {}", hostAddress);
      // recheck login status
      if (isSessionValid()) {
        LOGGER.debug("After rechecking. Re-login session not required for {}", hostAddress);
        return;
      }
      ComputeSessionCache cache = null;

      AaaLogin aaaLogin = new AaaLogin();
      aaaLogin.setInName(username);
      aaaLogin.setInPassword(password);

      Object response =
          ucsmTransportWrapper.execute(
              serviceURI, objectFactory.createAaaLogin(aaaLogin), Object.class);

      Assert.notNull(response, "Authentication Call resulted in Null Response");
      Assert.isTrue(
          response instanceof com.emc.cloud.platform.ucs.out.model.AaaLogin,
          "Invalid Response Type!");

      com.emc.cloud.platform.ucs.out.model.AaaLogin loginResponse =
          (com.emc.cloud.platform.ucs.out.model.AaaLogin) response;

      if (loginResponse != null
          && loginResponse.getOutCookie() != null
          && !loginResponse.getOutCookie().isEmpty()) {
        cache =
            new ComputeSessionCache(
                loginResponse.getOutCookie(),
                System.currentTimeMillis(),
                parseNumber(loginResponse.getOutRefreshPeriod()).longValue(),
                oneWayHash);
        encryptAndUpdateSessionCache(cache);
      } else {
        throw new ClientGeneralException(
            ClientMessageKeys.UNAUTHORIZED,
            new String[] {serviceURI, "", "Unable to authenticate username/credentials pair"});
      }
    } finally {
      writeUnlock();
    }
  }