public static String getCookieAsString(Cookie[] cookies) {
        StringBuilder sb = new StringBuilder();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                sb.append(cookie.getName()).append("=")
                        .append(cookie.getValue()).append(",")
                        .append(cookie.getDomain()).append("|");
            }
        }
        return sb.toString();
    }