code: public String encode(Cookie cookie) {
          final String name = checkNotNull(cookie, "cookie").name();
          final String value = cookie.value() != null ? cookie.value() : "";
  
          validateCookie(name, value);
  
          StringBuilder buf = stringBuilder();
  
          if (cookie.wrap()) {
              addQuoted(buf, name, value);
          } else {
              add(buf, name, value);
          }
  
          if (cookie.maxAge() != Long.MIN_VALUE) {
              add(buf, CookieHeaderNames.MAX_AGE, cookie.maxAge());
              Date expires = new Date(cookie.maxAge() * 1000 + System.currentTimeMillis());
              buf.append(CookieHeaderNames.EXPIRES);
              buf.append('=');
              DateFormatter.append(expires, buf);
              buf.append(';');
              buf.append(HttpConstants.SP_CHAR);
          }
  
          if (cookie.path() != null) {
              add(buf, CookieHeaderNames.PATH, cookie.path());
          }
  
          if (cookie.domain() != null) {
              add(buf, CookieHeaderNames.DOMAIN, cookie.domain());
          }
          if (cookie.isSecure()) {
              add(buf, CookieHeaderNames.SECURE);
          }
          if (cookie.isHttpOnly()) {
              add(buf, CookieHeaderNames.HTTPONLY);
          }
  
          return stripTrailingSeparator(buf);
      }
docs: Encodes the specified cookie into a Set-Cookie header value.
  
  @param cookie the cookie
  @return a single Set-Cookie header value