Skip to content

Commit 3de8ad5

Browse files
committed
Fixed DefaultClientTlsStrategy test failures on MacOS
1 parent c69f38f commit 3de8ad5

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestDefaultClientTlsStrategy.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import static org.hamcrest.MatcherAssert.assertThat;
3131

3232
import java.io.IOException;
33-
import java.net.InetAddress;
3433
import java.net.Socket;
3534
import java.util.Objects;
3635

@@ -370,7 +369,7 @@ void testHostnameVerificationClient() throws Exception {
370369

371370
final HttpHost target1 = new HttpHost("https", "localhost", server.getLocalPort());
372371

373-
try (final Socket socket = new Socket(InetAddress.getLocalHost(), server.getLocalPort())) {
372+
try (final Socket socket = new Socket("localhost", server.getLocalPort())) {
374373
final TlsSocketStrategy tlsStrategy = new DefaultClientTlsStrategy(
375374
SSLTestContexts.createClientSSLContext(),
376375
HostnameVerificationPolicy.CLIENT,
@@ -388,7 +387,7 @@ void testHostnameVerificationClient() throws Exception {
388387

389388
final HttpHost target2 = new HttpHost("https", "some-other-host", server.getLocalPort());
390389

391-
try (final Socket socket = new Socket(InetAddress.getLocalHost(), server.getLocalPort())) {
390+
try (final Socket socket = new Socket("localhost", server.getLocalPort())) {
392391
final TlsSocketStrategy tlsStrategy = new DefaultClientTlsStrategy(
393392
SSLTestContexts.createClientSSLContext(),
394393
HostnameVerificationPolicy.CLIENT,
@@ -403,7 +402,7 @@ void testHostnameVerificationClient() throws Exception {
403402
context));
404403
}
405404

406-
try (final Socket socket = new Socket(InetAddress.getLocalHost(), server.getLocalPort())) {
405+
try (final Socket socket = new Socket("localhost", server.getLocalPort())) {
407406
final TlsSocketStrategy tlsStrategy = new DefaultClientTlsStrategy(
408407
SSLTestContexts.createClientSSLContext(),
409408
HostnameVerificationPolicy.CLIENT,
@@ -432,7 +431,7 @@ void testHostnameVerificationBuiltIn() throws Exception {
432431

433432
final HttpHost target1 = new HttpHost("https", "localhost", server.getLocalPort());
434433

435-
try (final Socket socket = new Socket(InetAddress.getLocalHost(), server.getLocalPort())) {
434+
try (final Socket socket = new Socket("localhost", server.getLocalPort())) {
436435
final TlsSocketStrategy tlsStrategy = new DefaultClientTlsStrategy(
437436
SSLTestContexts.createClientSSLContext(),
438437
HostnameVerificationPolicy.BUILTIN,
@@ -450,7 +449,7 @@ void testHostnameVerificationBuiltIn() throws Exception {
450449

451450
final HttpHost target2 = new HttpHost("https", "some-other-host", server.getLocalPort());
452451

453-
try (final Socket socket = new Socket(InetAddress.getLocalHost(), server.getLocalPort())) {
452+
try (final Socket socket = new Socket("localhost", server.getLocalPort())) {
454453
final TlsSocketStrategy tlsStrategy = new DefaultClientTlsStrategy(
455454
SSLTestContexts.createClientSSLContext(),
456455
HostnameVerificationPolicy.BUILTIN,

0 commit comments

Comments
 (0)