docs: public static Session openSession(SSHBaseInterface base) throws JSchException {
          JSch jsch = new JSch();
  
          //will set Jsch static logger
          ThreadBoundJschLogger.getInstance(
                  base.getPluginLogger(),
                  getJschLogLevel(
                          base.getVerbose()
                          ? Project.MSG_DEBUG
                          : Project.MSG_INFO
                  )
          );
  
  
          if (base.getEnableSSHAgent()) {
              ConnectorFactory cf = ConnectorFactory.getDefault();
              try {
                  base.setSSHAgentProcess(new SSHAgentProcess(base.getTtlSSHAgent()));
                  cf.setUSocketPath(base.getSSHAgentProcess().getSocketPath());
                  cf.setPreferredUSocketFactories("jna,nc");
                  base.getPluginLogger().log(
                          Project.MSG_DEBUG,
                          "ssh-agent started with ttl " +
                          base.getTtlSSHAgent().toString()
                  );
                  try {
                      Connector c = cf.createConnector();
                      RemoteIdentityRepository identRepo = new RemoteIdentityRepository(c);
                      jsch.setIdentityRepository(identRepo);
                      base.getPluginLogger().log(
                              Project.MSG_DEBUG,
                              "ssh-agent used as identity repository."
                      );
                      base.getSshConfig().put("ForwardAgent", "yes");
                  } catch (AgentProxyException e) {
                      throw new JSchException("Unable to add key to ssh-agent: " + e);
                  }
              } catch (AgentProxyException e) {
                  throw new JSchException("Unable to start ssh-agent: " + e);
              }
          }
          
          if (null != base.getSshKeyData()) {
              base.getPluginLogger().log(Project.MSG_DEBUG, "Using stored private key data.");
              //XXX: reset password to null, which was non-null to bypass Ant's behavior
              base.setPassword(null);
              try {
                  jsch.addIdentity("sshkey", SSHTaskBuilder.streamBytes(base.getSshKeyData()), null, null);
              } catch (IOException e) {
                  throw new JSchException("Failed to ready private ssh key data");
              }
          }else  if (null != base.getUserInfo().getKeyfile()) {
              base.getPluginLogger().log(Project.MSG_DEBUG, "Using private key file: "+base.getUserInfo().getKeyfile());
              jsch.addIdentity(base.getUserInfo().getKeyfile());
          }
  
          if (!base.getUserInfo().getTrust() && base.getKnownhosts() != null) {
              base.getPluginLogger().log(Project.MSG_DEBUG, "Using known hosts: " + base.getKnownhosts());
              jsch.setKnownHosts(base.getKnownhosts());
          }
  
          Session session = jsch.getSession(base.getUserInfo().getName(), base.getHost(), base.getPort());
          long conTimeout = base.getConnectTimeout();
          if(conTimeout<1){
              conTimeout = base.getTimeout();
          }
          session.setTimeout((int) conTimeout);
          if (base.getVerbose()) {
              base.getPluginLogger().log(Project.MSG_DEBUG, "Set timeout to " + conTimeout);
          }
  
          session.setUserInfo(base.getUserInfo());
          if (base.getVerbose()) {
              base.getPluginLogger().log(Project.MSG_DEBUG, "Connecting to " + base.getHost() + ":" + base.getPort());
          }
          SSHTaskBuilder.configureSession(base.getSshConfig(), session);
  
          session.connect();
          return session;
      }