public Buffer asClientCookieBuffer(MemoryManager memoryManager) {
    if (memoryManager == null) memoryManager = MemoryManager.DEFAULT_MEMORY_MANAGER;

    final Buffer buffer = memoryManager.allocate(4096);
    CookieSerializerUtils.serializeClientCookies(buffer, this);
    buffer.trim();

    return buffer;
  }
  private void addCookies(final Request request, final HttpRequestPacket requestPacket) {

    final Collection<Cookie> cookies = request.getCookies();
    if (isNonEmpty(cookies)) {
      StringBuilder sb = new StringBuilder(128);
      org.glassfish.grizzly.http.Cookie[] gCookies =
          new org.glassfish.grizzly.http.Cookie[cookies.size()];
      convertCookies(cookies, gCookies);
      CookieSerializerUtils.serializeClientCookies(
          sb, false, config.isRfc6265CookieEncoding(), gCookies);
      requestPacket.addHeader(Header.Cookie, sb.toString());
    }
  }
 public String asClientCookieString() {
   final StringBuilder sb = new StringBuilder();
   CookieSerializerUtils.serializeClientCookies(sb, this);
   return sb.toString();
 }
 public String asServerCookieString() {
   final StringBuilder sb = new StringBuilder();
   CookieSerializerUtils.serializeServerCookie(sb, this);
   return sb.toString();
 }