use of java.net.CookieManager in project robovm by robovm.
the class CookiesTest method testNonMatchingDomainsRejected.
public void testNonMatchingDomainsRejected() throws Exception {
TestCookieStore cookieStore = new TestCookieStore();
CookieManager cookieManager = new CookieManager(cookieStore, ACCEPT_ORIGINAL_SERVER);
cookieManager.put(new URI("http://android.com/"), cookieHeaders("a=android;domain=google.com"));
assertEquals(Collections.<HttpCookie>emptyList(), cookieStore.cookies);
}
use of java.net.CookieManager in project robovm by robovm.
the class CookiesTest method testCookieStoreUriKeepsHost.
public void testCookieStoreUriKeepsHost() throws URISyntaxException {
CookieStore cookieStore = new CookieManager().getCookieStore();
cookieStore.add(new URI("http://b.com/"), new HttpCookie("a", "android"));
assertEquals(Arrays.asList(new URI("http://b.com")), cookieStore.getURIs());
}
use of java.net.CookieManager in project robovm by robovm.
the class CookiesTest method testPathDefaulting.
public void testPathDefaulting() throws Exception {
TestCookieStore cookieStore = new TestCookieStore();
CookieManager cookieManager = new CookieManager(cookieStore, ACCEPT_ORIGINAL_SERVER);
cookieManager.put(new URI("http://android.com/foo/bar"), cookieHeaders("a=android"));
assertEquals("/foo/", cookieStore.getCookie("a").getPath());
cookieManager.put(new URI("http://android.com/"), cookieHeaders("b=banana"));
assertEquals("/", cookieStore.getCookie("b").getPath());
cookieManager.put(new URI("http://android.com/foo/"), cookieHeaders("c=carrot"));
assertEquals("/foo/", cookieStore.getCookie("c").getPath());
}
use of java.net.CookieManager in project robovm by robovm.
the class CookiesTest method testCookieStoreUriDropsPort.
public void testCookieStoreUriDropsPort() throws URISyntaxException {
CookieStore cookieStore = new CookieManager().getCookieStore();
cookieStore.add(new URI("http://a.com:443/"), new HttpCookie("a", "android"));
assertEquals(Arrays.asList(new URI("http://a.com")), cookieStore.getURIs());
}
use of java.net.CookieManager in project robovm by robovm.
the class CookiesTest method testCookieStoreUriDropsPath.
public void testCookieStoreUriDropsPath() throws URISyntaxException {
CookieStore cookieStore = new CookieManager().getCookieStore();
cookieStore.add(new URI("http://a.com/a/"), new HttpCookie("a", "android"));
assertEquals(Arrays.asList(new URI("http://a.com")), cookieStore.getURIs());
}
Aggregations