use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method dontReturnCookieWhenDomainMatchesButPathIsDifferent.
private void dontReturnCookieWhenDomainMatchesButPathIsDifferent() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com/bar"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1; Domain=www.foo.com; path=/bar"));
assertTrue(store.get(Uri.create("http://www.foo.com/baz")).isEmpty());
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method shouldServeCookiesBasedOnTheUriScheme.
// rfc6265#section-1 Cookies for a given host are shared across all the ports on that host
private void shouldServeCookiesBasedOnTheUriScheme() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("https://foo.org/moodle/"), ClientCookieDecoder.LAX.decode("cookie1=VALUE1; Path=/"));
store.add(Uri.create("https://foo.org:443/moodle/login"), ClientCookieDecoder.LAX.decode("cookie1=VALUE2; Path=/"));
store.add(Uri.create("https://foo.org:443/moodle/login"), ClientCookieDecoder.LAX.decode("cookie1=VALUE3; Path=/; Secure"));
Uri uri = Uri.create("https://foo.org/moodle/login");
assertTrue(store.getAll().size() == 1);
assertTrue(store.get(uri).get(0).value().equals("VALUE3"));
assertTrue(store.get(uri).get(0).isSecure());
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method returnCookieWhenItWasSetOnSubdomain.
private void returnCookieWhenItWasSetOnSubdomain() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1; Domain=.foo.com"));
assertTrue(store.get(Uri.create("http://bar.foo.com")).size() == 1);
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method shouldServerOnSubdomainWhenDomainMatches.
// RFC 6265, 5.1.3. Domain Matching
private void shouldServerOnSubdomainWhenDomainMatches() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("https://x.foo.org/"), ClientCookieDecoder.LAX.decode("cookie1=VALUE1; Path=/; Domain=foo.org;"));
assertTrue(store.get(Uri.create("https://y.x.foo.org/")).size() == 1);
}
use of org.asynchttpclient.cookie.CookieStore in project async-http-client by AsyncHttpClient.
the class CookieStoreTest method handleDomainInCaseInsensitiveManner.
// RFC 2965 sec. 3.3.3
private void handleDomainInCaseInsensitiveManner() {
CookieStore store = new ThreadSafeCookieStore();
store.add(Uri.create("http://www.foo.com/bar"), ClientCookieDecoder.LAX.decode("ALPHA=VALUE1"));
assertTrue(store.get(Uri.create("http://www.FoO.com/bar")).size() == 1);
}
Aggregations