Skip to content

Commit

Permalink
tmp9999
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <[email protected]>
  • Loading branch information
Verdent committed Oct 16, 2024
1 parent ae525bb commit e201fd2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

package io.helidon.webclient.http1;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.InetSocketAddress;
import java.net.ProxySelector;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.URI;
import java.time.Duration;
Expand Down Expand Up @@ -361,7 +359,11 @@ public TcpClientConnection createConnection(ConnectionKey connectionKey,
proxyIdent = "";
} else {
SocketAddress proxyAddress = jnProxy.address();
proxyIdent = proxyAddress.toString();
if (proxyAddress instanceof InetSocketAddress inetSocketAddress) {
proxyIdent = inetSocketAddress.getHostName() + ":" + inetSocketAddress.getPort();
} else {
proxyIdent = proxyAddress.toString();
}
Limit proxyConnectionLimit = proxyConnectionLimits.getOrDefault(proxyIdent, NOOP);
maxProxyConnectionToken = proxyConnectionLimit.tryAcquire(!keepAlive);
}
Expand Down
1 change: 1 addition & 0 deletions webclient/http1/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
provides io.helidon.webclient.spi.ProtocolConfigProvider
with io.helidon.webclient.http1.Http1ProtocolConfigProvider;

uses io.helidon.common.concurrency.limits.spi.LimitProvider;
uses io.helidon.webclient.spi.SourceHandlerProvider;

}
35 changes: 35 additions & 0 deletions webclient/tests/http1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,39 @@
<scope>test</scope>
</dependency>
</dependencies>

<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.mock-server</groupId>-->
<!-- <artifactId>mockserver-maven-plugin</artifactId>-->
<!-- <version>5.14.0</version>-->
<!-- <configuration>-->
<!-- <serverPort>1080</serverPort>-->
<!-- <properties>-->
<!-- <property>-->
<!-- <name>listener</name>-->
<!-- <value>org.mockserver.maven.StopMockServerTestListener</value>-->
<!-- </property>-->
<!-- </properties>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>process-test-classes</id>-->
<!-- <phase>process-test-classes</phase>-->
<!-- <goals>-->
<!-- <goal>runForked</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>verify</id>-->
<!-- <phase>verify</phase>-->
<!-- <goals>-->
<!-- <goal>stopForked</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ void testSystemProxy2() {
}
}

@Test
void testDefaultProxySelector() {
Proxy proxy = Proxy.create();
successVerify(proxy, clientHttp2);
}

private void noHosts(HttpClient<?> client) {
Proxy proxy = Proxy.builder().host(PROXY_HOST).port(proxyPort).addNoProxy(PROXY_HOST).build();
try (HttpClientResponse response = client.get("/get").proxy(proxy).request()) {
Expand Down

0 comments on commit e201fd2

Please sign in to comment.