code: public void logout() {
          if (vimService != null) {
              try {
                  serviceInstance.getSessionManager().logout();
              }
              catch (Exception e) {
                  System.err.println("Failed to disconnect...");
              }
              vimService = null;
              serviceInstance = null;
          }
      }
docs: Disconnect from the server and clean up