@@ -0,0 +1,2076 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.%0Apackage ai.vespa.util.http.hc5;%0A%0Aimport org.apache.hc.client5.http.HttpRoute;%0Aimport org.apache.hc.client5.http.config.RequestConfig;%0Aimport org.apache.hc.client5.http.protocol.HttpClientContext;%0Aimport org.apache.hc.core5.http.HttpException;%0Aimport org.apache.hc.core5.http.HttpHost;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * @author jonmv%0A */%0Apublic class HttpToHttpsRoutePlannerTest %7B%0A%0A    final HttpToHttpsRoutePlanner planner = new HttpToHttpsRoutePlanner();%0A%0A    @Test%0A    public void verifySchemeMustBeHttp() throws HttpException %7B%0A        try %7B%0A            planner.determineRoute(new HttpHost(%22https%22, %22host%22, 1), new HttpClientContext());%0A        %7D%0A        catch (IllegalArgumentException e) %7B%0A            assertEquals(%22Scheme must be 'http' when using HttpToHttpsRoutePlanner%22, e.getMessage());%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void verifyPortMustBeSet() throws HttpException %7B%0A        try %7B%0A            planner.determineRoute(new HttpHost(%22http%22, %22host%22, -1), new HttpClientContext());%0A        %7D%0A        catch (IllegalArgumentException e) %7B%0A            assertEquals(%22Port must be set when using HttpToHttpsRoutePlanner%22, e.getMessage());%0A        %7D%0A    %7D%0A%0A%0A    @Test%0A    public void verifyProxyIsDisallowed() throws HttpException %7B%0A        HttpClientContext context = new HttpClientContext();%0A        context.setRequestConfig(RequestConfig.custom().setProxy(new HttpHost(%22proxy%22)).build());%0A        try %7B%0A            planner.determineRoute(new HttpHost(%22http%22, %22host%22, 1), context);%0A        %7D%0A        catch (IllegalArgumentException e) %7B%0A            assertEquals(%22Proxies are not supported with HttpToHttpsRoutePlanner%22, e.getMessage());%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void verifySchemeIsRewritten() throws HttpException %7B%0A        assertEquals(new HttpRoute(new HttpHost(%22https%22, %22host%22, 1)),%0A                     planner.determineRoute(new HttpHost(%22http%22, %22host%22, 1), new HttpClientContext()));%0A    %7D%0A%0A%7D%0A

Add test for route planner