private void setCookies(HttpResponse response, DefaultFullHttpResponse httpServletResponse) {
   if (response.getCookies() != null) {
     List<Cookie> cookieValues = new ArrayList<Cookie>();
     for (org.mockserver.model.Cookie cookie : response.getCookies()) {
       cookieValues.add(
           new DefaultCookie(cookie.getName().getValue(), cookie.getValue().getValue()));
     }
     if (!cookieValues.isEmpty()) {
       httpServletResponse.headers().add(SET_COOKIE, ServerCookieEncoder.LAX.encode(cookieValues));
     }
   }
 }
  private void setHeaders(HttpResponse response, DefaultFullHttpResponse httpServletResponse) {
    if (response.getHeaders() != null) {
      for (Header header : response.getHeaders()) {
        for (NottableString value : header.getValues()) {
          httpServletResponse.headers().add(header.getName().getValue(), value.getValue());
        }
      }
    }

    if (Strings.isNullOrEmpty(response.getFirstHeader(CONTENT_TYPE))) {
      if (response.getBody() != null && !Strings.isNullOrEmpty(response.getBody().toString())) {
        Charset bodyCharset = response.getBody().getCharset(null);
        String bodyContentType = response.getBody().getContentType();
        if (bodyCharset != null) {
          httpServletResponse
              .headers()
              .set(CONTENT_TYPE, bodyContentType + "; charset=" + bodyCharset.name().toLowerCase());
        } else if (bodyContentType != null) {
          httpServletResponse.headers().set(CONTENT_TYPE, bodyContentType);
        }
      }
    }
  }