Hi,
I have
HttpClientBuilder httpclientB = HttpClients.custom()
.setRoutePlanner(new CustomRoutePlanner(p));
where in CustomRoutePlanner's determineRoute I test the HttpHost target to see
if it needs to go through a proxy or not.
If the HttpHost target is say https://www.test.com and it doesn't go through
the proxy
I return new HttpRoute(target) and this throws an exception of port value of -1
the line of code is HttpRoute.java
Args.notNegative(targetHost.getPort(), "Target port");
it seems HttpHost is default port to -1 for default schema port
Is this a bug or am I doing something wrong??
For now I added this workaround
if (target.getPort() == -1) {
int port = target.getSchemeName().equals("http") ? 80 : 443;
target = new HttpHost(target.getSchemeName(),
target.getHostName(), port);
System.out.println("====determineRoute="+target.toString());
System.out.println("====determineRoute="+target.getPort());
}
return new HttpRoute(target);
Thanks