@SuppressWarnings("checkstyle:MagicNumber")
    @Test
    void testConfiguredPort() throws Exception {
        int port = 8080;
        HttpServletResponse response = createNiceMock(HttpServletResponse.class);
        HttpServletRequest request = createBaseMockRequest();

        String expected = "http://localhost:" + port + "/";
        expect(response.encodeRedirectURL(eq(expected))).andReturn(expected);
        replay(request);
        replay(response);

        PortFilter filter = new PortFilter();
        filter.setPort(port);
        boolean result = filter.onAccessDenied(request, response, null);

        verify(request);
        verify(response);
        assertFalse(result);
    }
This tests the case where the client (e.g. browser) specifies a simple request to http://localhost/
(i.e. http scheme with the implied port of 80). The redirectURL should reflect the configured port (8080) instead
of the implied port 80.

@throws Exception if there is a test failure
web/src/test/java/org/apache/shiro/web/filter/authz/PortFilterTest.java