@Override
    @SuppressWarnings("deprecation")
    public HttpRoute determineRoute(HttpHost target, HttpContext context) {
        if ( ! target.getSchemeName().equals("http") && ! target.getSchemeName().equals("https"))
            throw new IllegalArgumentException("Scheme must be 'http' or 'https' when using HttpToHttpsRoutePlanner, was '" + target.getSchemeName() + "'");

        if (HttpClientContext.adapt(context).getRequestConfig().getProxy() != null)
            throw new IllegalArgumentException("Proxies are not supported with HttpToHttpsRoutePlanner");

        int port = DefaultSchemePortResolver.INSTANCE.resolve(target);
        return new HttpRoute(new HttpHost("https", target.getAddress(), target.getHostName(), port));
    }
@Test
    void verifySchemeIsRewritten() {
        assertEquals(new HttpRoute(new HttpHost("https", "host", 1)),
                planner.determineRoute(new HttpHost("http", "host", 1), new HttpClientContext()));
    }