@Override
    public InputStream fetch(String fetchKey, Metadata metadata, ParseContext parseContext) throws IOException, TikaException {
        HttpFetcherConfig additionalHttpFetcherConfig = getAdditionalHttpFetcherConfig(parseContext);
        HttpGet get = new HttpGet(fetchKey);
        RequestConfig requestConfig = RequestConfig
                .custom()
                .setMaxRedirects(httpFetcherConfig.getMaxRedirects())
                .setRedirectsEnabled(httpFetcherConfig.getMaxRedirects() > 0)
                .build();
        get.setConfig(requestConfig);
        setHttpRequestHeaders(metadata, get);
        putAdditionalHeadersOnRequest(additionalHttpFetcherConfig, get);
        return execute(get, metadata, httpClient, true);
    }
@Test
    public void test4xxResponse() throws Exception {
        // Setup client to respond with 403
        mockClientResponse(buildMockResponse(HttpStatus.SC_FORBIDDEN, null));

        final Metadata meta = new Metadata();
        assertThrows(IOException.class, () -> httpFetcher.fetch(TEST_URL, meta, new ParseContext()));

        // Meta still populated
        assertEquals("403", meta.get("http-header:status-code"));
        assertEquals(TEST_URL, meta.get("http-connection:target-url"));
    }