UrlStreamingFacade implements StreamingFacade { @Override public InputStream getStream() throws IOException { return this.compress ? new GZIPInputStream(getStreamWithTimeouts()) : getStreamWithTimeouts(); } UrlStreamingFacade(String endpointLocation, boolean compress,
            int readTimeout, int connectionTimeout);  UrlStreamingFacade(URL url, boolean compress,
            int readTimeout, int connectionTimeout); @Override InputStream getStream();  }
@Test public void testGetStreamWithoutCompression() throws Exception { boolean compress = false; URL url = UrlStreamingFacade.class.getResource(contentTxtClassPath); String expectedResult = ClassPathResourceProvider.getResourceContent(contentTxtClassPath); UrlStreamingFacade facade = new UrlStreamingFacade(url, compress, readTimeout, connectionTimeout); try (InputStream stream = facade.getStream()) { assertNotNull(stream); assertEquals(expectedResult, IOUtils.toString(stream, "utf8")); } }
@Test public void testGetStreamWithCompression() throws Exception { boolean compress = true; URL url = UrlStreamingFacade.class.getResource(contentGzClassPath); String expectedResult = ClassPathResourceProvider.getResourceContent(contentTxtClassPath); UrlStreamingFacade facade = new UrlStreamingFacade(url, compress, readTimeout, connectionTimeout); try (InputStream stream = facade.getStream()) { assertNotNull(stream); assertEquals(expectedResult, IOUtils.toString(stream, "utf8")); } }