Mocing code from GCPJImpl.java to CookieUtils.java