List of usage examples for org.apache.http.entity InputStreamEntity InputStreamEntity
public InputStreamEntity(InputStream inputStream)
From source file:org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilterTests.java
@Test public void httpClientPreservesUnencodedData() throws Exception { setupContext();/* w ww .j av a2s. c o m*/ InputStreamEntity inputStreamEntity = new InputStreamEntity(new ByteArrayInputStream(new byte[] { 1 })); HttpRequest httpRequest = getFilter().buildHttpRequest("GET", "/app/get/1", inputStreamEntity, new LinkedMultiValueMap<>(), new LinkedMultiValueMap<>(), new MockHttpServletRequest()); CloseableHttpResponse response = getFilter().newClient().execute(new HttpHost("localhost", this.port), httpRequest); assertEquals(200, response.getStatusLine().getStatusCode()); String responseString = copyToString(response.getEntity().getContent(), Charset.forName("UTF-8")); assertTrue("Get 1".equals(responseString)); }