Package com.mastfrog.netty.http.client

Examples of com.mastfrog.netty.http.client.CookieStore


public class TestModuleTest {

    @Test
    public void test(TestHarness harn) throws Throwable {
        assertTrue(true);
        CookieStore store = new CookieStore();
        CallResult res = harn.get("/ok").setCookieStore(store).go().assertStatus(OK);
        res.assertHasHeader(Headers.SET_COOKIE.name());
        assertTrue(store.iterator().hasNext());
        res.assertCookieValue("xid", "1").throwIfError();

        res = harn.get("/ok").setCookieStore(store).go().assertStatus(OK);
        res.assertCookieValue("xid", "2");
        res.throwIfError();
        assertEquals(store + " " + store.size(), 1, store.size());
        Iterator<Cookie> iter = store.iterator();
        assertTrue(store + "", iter.hasNext());
        iter.next();
        assertFalse(store + "", iter.hasNext());

        res = harn.get("/cookie").setCookieStore(store).addQueryPair("key", "foo")
                .addQueryPair("value", "bar").go()
                .assertStatus(OK)
                .assertCookieValue("foo", "bar");

        res = harn.get("/cookie").setCookieStore(store).addQueryPair("key", "wump")
                .addQueryPair("value", "baz").go()
                .assertStatus(OK)
                .assertCookieValue("wump", "baz");

        assertEquals(store + "", "baz", store.get("wump"));
        assertEquals(store + "", "bar", store.get("foo"));

    }
View Full Code Here

TOP

Related Classes of com.mastfrog.netty.http.client.CookieStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.