@Test public void testBuildContent() throws Exception { HttpRequest nettyRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_0, HttpMethod.GET, "www.google.com"); RecordedHttpRequestBuilder recordedHttpRequestBuilder = new RecordedHttpRequestBuilder(nettyRequest); String charset = "UTF-8"; String str1 = "first content"; HttpContent httpContent1 = new DefaultHttpContent(Unpooled.copiedBuffer(str1.getBytes(charset))); recordedHttpRequestBuilder.appendHttpContent(httpContent1); String str2 = "second content"; HttpContent httpContent2 = new DefaultHttpContent(Unpooled.copiedBuffer(str2.getBytes(charset))); recordedHttpRequestBuilder.appendHttpContent(httpContent2); String lastStr = "Last chunk"; HttpContent lastContent = new DefaultLastHttpContent(Unpooled.copiedBuffer(lastStr.getBytes(charset))); recordedHttpRequestBuilder.appendHttpContent(lastContent); RecordedHttpRequest recordedHttpRequest = recordedHttpRequestBuilder.build(); Assert .assertEquals((str1 + str2 + lastStr).getBytes(charset), recordedHttpRequest.getHttpBody().getContent(charset)); }
public RecordedHttpRequest build() { return new RecordedHttpRequest(_httpMethod, _uri, getHeaders(), getBody()); }
RecordedHttpRequestBuilder extends RecordedHttpMessageBuilder { public RecordedHttpRequest build() { return new RecordedHttpRequest(_httpMethod, _uri, getHeaders(), getBody()); } }
RecordedHttpRequestBuilder extends RecordedHttpMessageBuilder { public RecordedHttpRequest build() { return new RecordedHttpRequest(_httpMethod, _uri, getHeaders(), getBody()); } RecordedHttpRequestBuilder(HttpRequest nettyHttpRequest); }
RecordedHttpRequestBuilder extends RecordedHttpMessageBuilder { public RecordedHttpRequest build() { return new RecordedHttpRequest(_httpMethod, _uri, getHeaders(), getBody()); } RecordedHttpRequestBuilder(HttpRequest nettyHttpRequest); void interpretHttpRequest(HttpRequest nettyHttpRequest); @Override void addHeaders(HttpMessage httpMessage); RecordedHttpRequest build(); }
RecordedHttpRequestBuilder extends RecordedHttpMessageBuilder { public RecordedHttpRequest build() { return new RecordedHttpRequest(_httpMethod, _uri, getHeaders(), getBody()); } RecordedHttpRequestBuilder(HttpRequest nettyHttpRequest); void interpretHttpRequest(HttpRequest nettyHttpRequest); @Override void addHeaders(HttpMessage httpMessage); RecordedHttpRequest build();  }