final Header header = new BasicHeader("Set-Cookie2", "name=value;Port=\"80,800,8000\";Version=1;Port=nonsense");
final List<Cookie> cookies = cookiespec.parse(header, origin);
Assert.assertNotNull(cookies);
Assert.assertEquals(1, cookies.size());
// only the first occurrence of port attribute is considered, others ignored
final ClientCookie cookie = (ClientCookie) cookies.get(0);
final int[] ports = cookie.getPorts();
Assert.assertNotNull(ports);
Assert.assertEquals(3, ports.length);
Assert.assertEquals(80, ports[0]);
Assert.assertEquals(800, ports[1]);
Assert.assertEquals(8000, ports[2]);
Assert.assertTrue(cookie.containsAttribute(ClientCookie.PORT_ATTR));
}