@@ -0,0 +1,1513 @@
+package bkromhout.fdl.util;%0A%0Aimport okhttp3.Cookie;%0Aimport okhttp3.CookieJar;%0Aimport okhttp3.HttpUrl;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashSet;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0A%0A/**%0A * An implementation of OkHttp's %7B@code CookieJar%7D. Only keeps cookies per-run.%0A * @author Brenden Kromhout%0A */%0Apublic class CookieMonster implements CookieJar %7B%0A    /**%0A     * Singleton instance.%0A     */%0A    private static CookieMonster INSTANCE = null;%0A    /**%0A     * Cookies held by the cookie monster.%0A     */%0A    private final HashSet%3CCookie%3E cookies;%0A%0A    /**%0A     * Get the %7B@link CookieMonster%7D instance.%0A     * @return Instance.%0A     */%0A    public static CookieMonster get() %7B%0A        if (INSTANCE == null) INSTANCE = new CookieMonster();%0A        return INSTANCE;%0A    %7D%0A%0A    // C is for Cookie.%0A    private CookieMonster() %7B%0A        this.cookies = new HashSet%3C%3E();%0A    %7D%0A%0A    @Override%0A    public void saveFromResponse(HttpUrl url, List%3CCookie%3E cookies) %7B%0A        this.cookies.addAll(cookies);%0A    %7D%0A%0A    @Override%0A    public List%3CCookie%3E loadForRequest(HttpUrl url) %7B%0A        List%3CCookie%3E validCookies = new ArrayList%3C%3E();%0A%0A        for (Iterator%3CCookie%3E it = cookies.iterator(); it.hasNext(); ) %7B%0A            Cookie currentCookie = it.next();%0A%0A            if (currentCookie.expiresAt() %3C System.currentTimeMillis())%0A                it.remove();%0A            else if (currentCookie.matches(url))%0A                validCookies.add(currentCookie);%0A        %7D%0A%0A        return validCookies;%0A    %7D%0A%7D%0A

Add CookieMonster, a CookieJar implementation.