Header header = new BasicHeader("Set-Cookie2", "name=value;Domain=.domain.com;Version=1;Domain=");
List<Cookie> cookies = cookiespec.parse(header, origin);
Assert.assertNotNull(cookies);
Assert.assertEquals(1, cookies.size());
// only the first occurrence of domain attribute is considered, others ignored
ClientCookie cookie = (ClientCookie) cookies.get(0);
Assert.assertEquals(".domain.com", cookie.getDomain());
Assert.assertTrue(cookie.containsAttribute(ClientCookie.DOMAIN_ATTR));
// should put a leading dot if there is no dot in front of domain
header = new BasicHeader("Set-Cookie2", "name=value;Domain=domain.com;Version=1");
cookies = cookiespec.parse(header, origin);
Assert.assertNotNull(cookies);
Assert.assertEquals(1, cookies.size());
cookie = (ClientCookie) cookies.get(0);
Assert.assertEquals(".domain.com", cookie.getDomain());
}