private static void encode(boolean strict, StringBuilder buf, Cookie c) {
        final String name = c.name();
        final String value = firstNonNull(c.value(), "");

        CookieUtil.validateCookie(strict, name, value);

        if (c.isValueQuoted()) {
            addQuoted(buf, name, value);
        } else {
            add(buf, name, value);
        }
    }
Encodes the specified cookies into a single {@code "Cookie"} header value.

@param strict whether to validate that name and value chars are in the valid scope and
              to sort the cookies into order of decreasing path length, as specified in RFC 6265.
              If {@code false}, the cookies are encoded in the order in which they are given.
@param cookiesIt the {@link Iterator} of the {@link Cookie}s to encode.
@return a RFC 6265-style {@code "Cookie"} header value, or {@code null} if no cookies were specified.
core/src/main/java/com/linecorp/armeria/common/ClientCookieEncoder.java