code: @Override
    public AppSession getSession(String sessionId, Class<? extends AppSession> aClass) {
      if (sessionId == null) {
        throw new IllegalArgumentException("SessionId must not be null");
      }
      if (!this.iss.exists(sessionId)) {
        return null;
      }
      AppSession appSession = null;
      try {
        if (aClass == ClientAccSession.class) {
          IClientAccSessionData data = (IClientAccSessionData) this.sessionDataFactory.getAppSessionData(ClientAccSession.class, sessionId);
          ClientAccSessionImpl clientSession =
              new ClientAccSessionImpl(data, sessionFactory, getClientSessionListener(), getClientContextListener(), getStateListener());
  
          clientSession.getSessions().get(0).setRequestListener(clientSession);
          appSession = clientSession;
        }
        else if (aClass == ServerAccSession.class) {
          ServerAccSessionImpl serverSession = null;
          IServerAccSessionData data = (IServerAccSessionData) this.sessionDataFactory.getAppSessionData(ServerAccSession.class, sessionId);
  
          //here we use shorter con, since some data is already present.
          serverSession = new ServerAccSessionImpl(data, sessionFactory,  getServerSessionListener(), getServerContextListener(), getStateListener());
          serverSession.getSessions().get(0).setRequestListener(serverSession);
          appSession = serverSession;
        }
        else {
          throw new IllegalArgumentException("Wrong session class: " + aClass + ". Supported[" + ClientAccSession.class + "," + ServerAccSession.class + "]");
        }
      }
      catch (Exception e) {
        logger.error("Failure to obtain new Accounting Session.", e);
      }
  
      return appSession;
    }
docs: App Session Factory ------------------------------------------------------