ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
context.setContextPath( "/" );
context.addEventListener( new EnvironmentLoaderListener() );
// Add root ShiroFilter, all remaining filters and filter chains are defined in shiro.ini's [urls] section.
FilterHolder filterHolder = new FilterHolder( new ShiroFilter() );
ServletHolder servletHolder = new ServletHolder( new MockServlet() );
EnumSet<DispatcherType> types = EnumSet.allOf( DispatcherType.class );
context.addFilter( filterHolder, "/*", types );
context.addFilter( new FilterHolder( new TestFilter() ), "/*", types );