### Question:
StyxToNettyResponseTranslator implements ResponseTranslator { public HttpResponse toNettyResponse(LiveHttpResponse httpResponse) { io.netty.handler.codec.http.HttpVersion version = toNettyVersion(httpResponse.version()); HttpResponseStatus httpResponseStatus = HttpResponseStatus.valueOf(httpResponse.status().code()); DefaultHttpResponse nettyResponse = new DefaultHttpResponse(version, httpResponseStatus, true); httpResponse.headers().forEach(httpHeader -> nettyResponse.headers().add(httpHeader.name(), httpHeader.value())); return nettyResponse; }  HttpResponse toNettyResponse(LiveHttpResponse httpResponse);  }### Answer:
@Test public void shouldCreateNettyResponseWithoutHeaders() throws Exception { LiveHttpResponse styxResponse = new LiveHttpResponse.Builder(OK) .version(HTTP_1_1) .build(); io.netty.handler.codec.http.HttpResponse nettyResponse = translator.toNettyResponse(styxResponse); assertThat(nettyResponse.status(), equalTo(io.netty.handler.codec.http.HttpResponseStatus.OK)); assertThat(nettyResponse.protocolVersion(), equalTo(io.netty.handler.codec.http.HttpVersion.HTTP_1_1)); }
@Test public void shouldCreateNettyResponseWithHostHeader() { LiveHttpResponse styxResponse = new LiveHttpResponse.Builder(OK) .header("Host", "localhost") .build(); io.netty.handler.codec.http.HttpResponse nettyResponse = translator.toNettyResponse(styxResponse); assertTrue(nettyResponse.headers().containsValue("Host", "localhost", false)); }
@Test public void shouldCreateNettyResponseWithCookieWithAttributes() { ResponseCookie cookie = responseCookie("cookie-test", "cookie-value") .domain("cookie-domain") .path("cookie-path") .maxAge(1234) .httpOnly(true) .secure(true) .build(); LiveHttpResponse styxResponse = new LiveHttpResponse.Builder(OK) .cookies(cookie) .build(); io.netty.handler.codec.http.HttpResponse nettyResponse = translator.toNettyResponse(styxResponse); String setCookie = nettyResponse.headers().get(SET_COOKIE); Cookie nettyCookie = ClientCookieDecoder.LAX.decode(setCookie); assertThat(nettyCookie.name(), is("cookie-test")); assertThat(nettyCookie.value(), is("cookie-value")); assertThat(nettyCookie.domain(), is("cookie-domain")); assertThat(nettyCookie.maxAge(), is(1234L)); assertThat(nettyCookie.isHttpOnly(), is(true)); assertThat(nettyCookie.isSecure(), is(true)); }