SessionManager implements Closeable { public void propagateSession(RequestWithSession request, ResponseWithSessionId response) { if (request.getAttribute(SESSION_PROPAGATED) == null) { request.setAttribute(SESSION_PROPAGATED, Boolean.TRUE); tracking.propagateSession(request, response); } } SessionManager(ExecutorFacade executors, SessionFactory factory, SessionRepository repository,
      SessionTracking tracking, SessionNotifier notifier, SessionConfiguration configuration, ClassLoader classLoader); RepositoryBackedSession fetchSession(String sessionId, boolean updateTimestamp); RepositoryBackedSession getSession(RequestWithSession request, boolean create,
      SessionTracking.IdAndSource forceId); void propagateSession(RequestWithSession request, ResponseWithSessionId response); void delete(String sessionId, boolean expired); void requestFinished(); Future<?> submit(String timer, Runnable task); ScheduledFuture<?> schedule(String timer, Runnable task, long period); void deleteAsync(final String sessionId, final boolean expired); SessionRepository getRepository(); SessionNotifier getNotifier(); void invokeCommit(RepositoryBackedSession session); SessionConfiguration getConfiguration(); ClassLoader getSessionClassLoader(); SerializerDeserializer getSerializerDeserializer(); void invalidationConflict(RepositoryBackedSession session, boolean onExpiry); MetricRegistry getMetrics(); String encodeUrl(RequestWithSession request, String url); void reset(); @Override void close(); void switchSessionId(RepositoryBackedSession session); void switchSessionId(RepositoryBackedSession session, String forceId); @Override String toString(); void remove(SessionData sessionData); boolean isConnected();  }
@Test public void testPropagateSession() { RequestWithSession request = mock(RequestWithSession.class); ResponseWithSessionId response = mock(ResponseWithSessionId.class); sessionManager.propagateSession(request, response); verify(tracking).propagateSession(request, response); verify(request).setAttribute(SessionManager.SESSION_PROPAGATED, Boolean.TRUE); }
@Test public void testPropagateSessionAlreadyPropagated() { RequestWithSession request = mock(RequestWithSession.class); ResponseWithSessionId response = mock(ResponseWithSessionId.class); when(request.getAttribute(SessionManager.SESSION_PROPAGATED)).thenReturn(Boolean.TRUE); sessionManager.propagateSession(request, response); verify(tracking, never()).propagateSession(request, response); verify(request, never()).setAttribute(SessionManager.SESSION_PROPAGATED, Boolean.TRUE); }