@Test
    public void testUnzipFails() throws Exception {
        final String testData = "foo bar";
        InputStream inputStream = new ByteArrayInputStream(testData.getBytes());
        HttpRequest httpRequest = mock(HttpRequest.class);
        when(httpRequest.getHeader("Content-Encoding")).thenReturn("gzip");
        InputStream decompressedStream = FeedHandler.unzipStreamIfNeeded(inputStream, httpRequest);
        final StringBuilder processedInput = new StringBuilder();
        while (true) {
            int readValue = decompressedStream.read();
            if (readValue < 0) {
                break;
            }
            processedInput.append((char)readValue);
        }
        assertEquals(processedInput.toString(), testData);
    }
Test by setting encoding, but not compressing data.
@throws Exception
vespaclient-container-plugin/src/test/java/com/yahoo/vespa/http/server/FeedHandlerCompressionTest.java