org.apache.http.conn.util.PublicSuffixMatcher Java Examples
The following examples show how to use
org.apache.http.conn.util.PublicSuffixMatcher.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatefulHttpClient.java From BigData-In-Practice with Apache License 2.0 | 5 votes |
private void initCookieStore() { PublicSuffixMatcher publicSuffixMatcher = PublicSuffixMatcherLoader.getDefault(); Registry<CookieSpecProvider> cookieSpecReg = RegistryBuilder.<CookieSpecProvider>create() .register(CookieSpecs.DEFAULT, new DefaultCookieSpecProvider(publicSuffixMatcher)) .register(CookieSpecs.STANDARD, new RFC6265CookieSpecProvider(publicSuffixMatcher)).build(); CookieStore cookieStore = new BasicCookieStore(); context = HttpClientContext.create(); context.setCookieSpecRegistry(cookieSpecReg); context.setCookieStore(cookieStore); }
Example #2
Source File: AuthenticationTlsHostnameVerificationTest.java From pulsar with Apache License 2.0 | 5 votes |
/** * This test verifies {@link DefaultHostnameVerifier} behavior and gives fair idea about host matching result * * @throws Exception */ @Test public void testDefaultHostVerifier() throws Exception { log.info("-- Starting {} test --", methodName); Method matchIdentityStrict = DefaultHostnameVerifier.class.getDeclaredMethod("matchIdentityStrict", String.class, String.class, PublicSuffixMatcher.class); matchIdentityStrict.setAccessible(true); Assert.assertTrue((boolean) matchIdentityStrict.invoke(null, "pulsar", "pulsar", null)); Assert.assertFalse((boolean) matchIdentityStrict.invoke(null, "pulsar.com", "pulsar", null)); Assert.assertTrue((boolean) matchIdentityStrict.invoke(null, "pulsar-broker1.com", "pulsar*.com", null)); // unmatched remainder: "1-broker." should not contain "." Assert.assertFalse((boolean) matchIdentityStrict.invoke(null, "pulsar-broker1.com", "pulsar*com", null)); Assert.assertFalse((boolean) matchIdentityStrict.invoke(null, "pulsar.com", "*", null)); log.info("-- Exiting {} test --", methodName); }