code: public Session getSession() throws JSchException {
          if ( session == null || !session.isConnected() ) {
              logger.debug( "getting new session from factory session" );
              session = sessionFactory.newSession();
              logger.debug( "connecting session" );
              session.connect();
          }
          return session;
      }
docs: Returns a connected session.
  
  @return A connected session
  
  @throws JSchException
  If unable to connect the session