code: public void setCookie(String name, String value, String path, Date expirationDate, boolean secure, boolean httpOnly) {
          if (remote == null)
              throw new IllegalStateException("Cannot setCookie since remote == null");
          if (path == null || path.length() == 0)
              path = remote.getPath();
          Cookie.Builder builder = new Cookie.Builder();
          builder.name(name).value(value).domain(remote.getHost()).path(path);
          if (expirationDate != null)
              builder.expiresAt(expirationDate.getTime());
          List<Cookie> cookies = Collections.singletonList(builder.build());
          this.clientFactory.addCookies(cookies);
      }
docs: For java docs, see Replication.setCookie()