#fixed code
                                @Test
    public void shouldHandleExceptionDuringRequestCreation() throws URISyntaxException, IOException {

        exception.expect(IOException.class);
        exception.expectMessage("Could not create request");

        final AsyncClientHttpRequestFactory factory = (uri, httpMethod) -> {
            throw new IOException("Could not create request");
        };

        Rest.builder().requestFactory(factory).build()
                .get("http://localhost/")
                .dispatch(series(),
                        on(SUCCESSFUL).call(pass()));
    }
#vulnerable code 
                                @Test
    public void shouldHandleExceptionDuringRequestCreation() throws URISyntaxException, IOException {

        exception.expect(IOException.class);
        exception.expectMessage("Could not create request");

        final AsyncClientHttpRequestFactory factory = (uri, httpMethod) -> {
            throw new IOException("Could not create request");
        };

        Rest.create(factory, emptyList())
                .get("http://localhost/")
                .dispatch(series(),
                        on(SUCCESSFUL).call(pass()));
    } 
                            #location 13 
                            #vulnerability type RESOURCE_LEAK