public Connection connect() {
   if (!isConnected()) {
     try {
       _connect();
     } catch (Exception e) {
       Throwable cause = (e.getCause() != null) ? e.getCause() : e;
       throw new BasicConnectionException(
           "failed to connect: " + e.getMessage() + " : " + cause.getMessage(), cause);
     }
   }
   return this;
 }
 public Connection disconnect() {
   if (this.isConnected()) {
     try {
       vimPort.logout(serviceContent.getSessionManager());
     } catch (Exception e) {
       Throwable cause = e.getCause();
       throw new BasicConnectionException(
           "failed to disconnect properly: " + e.getMessage() + " : " + cause.getMessage(), cause);
     } finally {
       // A connection is very memory intensive, I'm helping the garbage collector here
       userSession = null;
       serviceContent = null;
       vimPort = null;
       vimService = null;
     }
   }
   return this;
 }