@Test
    void willBlockAndAllowBasedOnIpSource() throws Exception {
        IpSource source = new IpSource() {
            public Collection<String> getAuthorizedIps() {
                return Collections.singleton("192.168.0.0/16");
            }

            public Collection<String> getDeniedIps() {
                return Collections.singleton("192.168.33.0/24");
            }
        };
        IpFilter filter = new IpFilter();
        filter.setIpSource(source);
        HttpServletRequest request = createNiceMock(HttpServletRequest.class);
        expect(request.getRemoteAddr()).andReturn("192.168.33.44");
        replay(request);
        assertFalse(filter.isAccessAllowed(request, null, null));
        verify(request);
    }
Test cases for the {@link AuthorizationFilter} class.

@since 2.0
web/src/test/java/org/apache/shiro/web/filter/authz/IpFilterTest.java