1 | void testNewCookie() throws Exception {↵ | | 1 | void testCookies1() throws Exception {↵
|
2 | URL url = new URL("http://a.b.c/");↵ | | 2 | URL url = new URL("http://a.b.c.d/testCookies1");↵
|
3 | man.addCookieFromHeader("test=1; expires=Mon, 01-Jan-2990 00:00:00 GMT", url);↵ | | 3 | man.addCookieFromHeader("test1=1; comment=\"how,now\", test2=2; version=1", url);↵
|
4 | assertEquals(1,man.getCookieCount());↵ | | 4 | assertEquals(2,man.getCookieCount());↵
|
5 | String s = man.getCookieHeaderForURL(url);↵ | | 5 | String s = man.getCookieHeaderForURL(url);↵
|
6 | assertNotNull(s);↵ | | 6 | assertNotNull(s);↵
|
7 | assertEquals("test=1", s);↵ | | 7 | assertEquals("test1=1; test2=2", s);↵
|
8 | }↵ | | 8 | }↵
|
|
9 | // Test multi-cookie header handling↵ | | 9 | ↵
|
10 | public void testCookies1() throws Exception {↵ | | 10 | public void testCookies2() throws Exception {↵
|
11 | URL url = new URL("http://a.b.c.d/testCookies1");↵ | | 11 | URL url = new URL("https://a.b.c.d/testCookies2");↵
|
12 | man.addCookieFromHeader("test1=1; comment=\"how,now\", test2=2; version=1", url);↵ | | 12 | man.addCookieFromHeader("test1=1;secure, test2=2;secure", url);↵
|
13 | assertEquals(2,man.getCookieCount());↵ | | 13 | assertEquals(2,man.getCookieCount());↵
|
14 | String s = man.getCookieHeaderForURL(url);↵ | | 14 | String s = man.getCookieHeaderForURL(url);↵
|
15 | assertNotNull(s);↵ | | 15 | assertNotNull(s);↵
|
16 | assertEquals("test1=1; test2=2", s);↵ | | 16 | assertEquals("test1=1; test2=2", s);↵
|
17 | | | 17 |
|