@Test
    void testSessionListenerStopNotification() {
        final boolean[] stopped = new boolean[1];
        SessionListener listener = new SessionListenerAdapter() {
            public void onStop(Session session) {
                stopped[0] = true;
            }
        };
        sm.getSessionListeners().add(listener);
        Session session = sm.start(null);
        sm.stop(new DefaultSessionKey(session.getId()));
        assertTrue(stopped[0]);
    }
Unit test for the {@link DefaultSessionManager DefaultSessionManager} implementation.
core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java