use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testInvalidMatchDomain.
public void testInvalidMatchDomain() throws Exception {
Cookie cookie = new Cookie("beta.gamma.com", "name", null, "/", null, false);
cookie.setDomainAttributeSpecified(true);
cookie.setPathAttributeSpecified(true);
CookieSpec cookiespec = new CookieSpecBase();
cookiespec.validate("alpha.beta.gamma.com", 80, "/", false, cookie);
assertTrue(cookiespec.match("alpha.beta.gamma.com", 80, "/", false, cookie));
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testInvalidSecondDomainLevelCookieMatch2.
public void testInvalidSecondDomainLevelCookieMatch2() throws Exception {
Cookie cookie = new Cookie("sourceforge.net", "name", null, "/", null, false);
cookie.setDomainAttributeSpecified(true);
cookie.setPathAttributeSpecified(true);
CookieSpec cookiespec = new CookieSpecBase();
assertFalse(cookiespec.match("antisourceforge.net", 80, "/", false, cookie));
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testParseAttributeUnknownValue.
public void testParseAttributeUnknownValue() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie();
cookiespec.parseAttribute(new NameValuePair("nonsense", null), cookie);
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testValidateBlankHost.
public void testValidateBlankHost() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie();
try {
cookiespec.validate(" ", 80, "/", false, cookie);
fail("IllegalArgumentException must have been thrown");
} catch (IllegalArgumentException expected) {
}
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testParseWithNullHostAndPath.
public void testParseWithNullHostAndPath() throws Exception {
Header header = new Header("Set-Cookie", "cookie-name=cookie-value; domain=127.0.0.1; path=/; secure");
CookieSpec cookiespec = new CookieSpecBase();
try {
Cookie[] parsed = cookieParse(cookiespec, null, 80, null, false, header);
fail("IllegalArgumentException should have been thrown");
} catch (IllegalArgumentException e) {
// expected
}
}
Aggregations