@Test public void bigResponse() throws Exception { List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>(); ODataResponse response = new ODataResponse(); response.setStatusCode(HttpStatusCode.OK.getStatusCode()); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.TEXT_PLAIN.toContentTypeString()); String bigData = generateData(10000); response.setContent(IOUtils.toInputStream(bigData)); parts.add(new ODataResponsePart(Collections.singletonList(response), false)); final BatchResponseSerializer serializer = new BatchResponseSerializer(); final InputStream content = serializer.serialize(parts, BOUNDARY); assertNotNull(content); final BatchLineReader reader = new BatchLineReader(content); final List<String> body = reader.toList(); reader.close(); int line = 0; assertEquals(10, body.size()); assertEquals("--" + BOUNDARY + CRLF, body.get(line++)); assertEquals("Content-Type: application/http" + CRLF, body.get(line++)); assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++)); assertEquals("Content-Type: text/plain" + CRLF, body.get(line++)); assertEquals("Content-Length: 10000" + CRLF, body.get(line++)); assertEquals(CRLF, body.get(line++)); assertEquals(bigData + CRLF, body.get(line++)); assertEquals("--" + BOUNDARY + "--" + CRLF, body.get(line++)); }
public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); } }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }  }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }  InputStream serialize(final List<ODataResponsePart> responses, final String boundary); }
BatchResponseSerializer { public InputStream serialize(final List<ODataResponsePart> responses, final String boundary) throws BatchSerializerException { BodyBuilder builder = createBody(responses, boundary); return new ByteArrayInputStream(builder.getContent()); }  InputStream serialize(final List<ODataResponsePart> responses, final String boundary);  }