@Test
public void testSecurityError() throws Exception {

    String headerValue = "custno=12345;comment=test; version=1," +
        "name=John;version=1;max-age=600;secure;domain=jakarta.apache.org";
    Header header = new BasicHeader("set-cookie", headerValue);
    CookieSpec cookiespec = new BrowserCompatSpec();
    CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", true);
    try {
        List<Cookie> cookies = cookiespec.parse(header, origin);
        for (int i = 0; i < cookies.size(); i++) {
            cookiespec.validate(cookies.get(i), origin);
        }
        Assert.fail("MalformedCookieException exception should have been thrown");
    } catch (MalformedCookieException ex) {
        // expected
    }
}