@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 testJwt() throws Exception {
        byte[] randomBytes = new byte[32];
        new SecureRandom().nextBytes(randomBytes);

        httpFetcher.jwtGenerator = Mockito.mock(JwtGenerator.class);

        final Metadata meta = new Metadata();
        meta.set(TikaCoreProperties.RESOURCE_NAME_KEY, "fileName");

        try (final InputStream ignored = httpFetcher.fetch(TEST_URL, meta, new ParseContext())) {
            // HTTP headers added into meta
            assertEquals("200", meta.get("http-header:status-code"));
            assertEquals(TEST_URL, meta.get("http-connection:target-url"));
            // Content size included in meta
            assertEquals("15", meta.get("Content-Length"));

            // Filename passed in should be preserved
            assertEquals("fileName", meta.get(TikaCoreProperties.RESOURCE_NAME_KEY));
        }

        Mockito
                .verify(httpFetcher.jwtGenerator)
                .jwt();
    }