@BeforeEach
    public void setup() {
        ThreadContext.remove();
        sm = new DefaultSessionManager();
        this.session = new DelegatingSession(sm, new DefaultSessionKey(sm.start(null).getId()));
    }
Unit test for the {@link DelegatingSession} class.
core/src/test/java/org/apache/shiro/session/mgt/DelegatingSessionTest.java