@Test
    public void testRetrieveIpFromHeaderUsingConstructor() {
        val context = MockWebContext.create().addRequestHeader(HEADER_NAME, GOOD_IP).setRemoteAddress(LOCALHOST);
        // test for varargs
        CredentialsExtractor ipExtractor = new IpExtractor("fooBar", HEADER_NAME, "barFoo");
        val credentials = (TokenCredentials) ipExtractor.extract(new CallContext(context, new MockSessionStore())).get();
        assertEquals(GOOD_IP, credentials.getToken());
        // test for edge case of 1 header
        CredentialsExtractor ipExtractor2 = new IpExtractor(HEADER_NAME);
        val credentials2 = (TokenCredentials) ipExtractor2.extract(new CallContext(context, new MockSessionStore())).get();
        assertEquals(GOOD_IP, credentials2.getToken());
    }
This class tests the {@link IpExtractor}.

@author Jerome Leleu
@since 1.8.0
pac4j-http/src/test/java/org/pac4j/http/credentials/extractor/IpExtractorTests.java