diff --git a/pom.xml b/pom.xml index 27cdce5246c..4e6c4f9863f 100644 --- a/pom.xml +++ b/pom.xml @@ -194,7 +194,7 @@ com.aayushatharva.brotli4j brotli4j - 1.8.0 + 1.12.0 test diff --git a/src/main/java/io/vertx/core/net/impl/ConnectionBase.java b/src/main/java/io/vertx/core/net/impl/ConnectionBase.java index a5394ba175a..c354feac77c 100644 --- a/src/main/java/io/vertx/core/net/impl/ConnectionBase.java +++ b/src/main/java/io/vertx/core/net/impl/ConnectionBase.java @@ -629,6 +629,9 @@ public SocketAddress remoteAddress() { address = socketAdressOverride(REMOTE_ADDRESS_OVERRIDE); if (address == null) { address = channelRemoteAddress(); + if (address != null && address.isDomainSocket() && address.path().isEmpty()) { + address = channelLocalAddress(); + } } if (address != null) { remoteAddress = address; @@ -654,10 +657,6 @@ public SocketAddress remoteAddress(boolean real) { private SocketAddress channelLocalAddress() { java.net.SocketAddress addr = chctx.channel().localAddress(); - if (addr == null && channel().getClass().getSimpleName().endsWith("DomainSocketChannel")) { - // Workaround bug https://github.com/netty/netty/issues/13417 - return SocketAddress.domainSocketAddress(""); - } return addr != null ? vertx.transport().convert(addr) : null; } @@ -667,6 +666,9 @@ public SocketAddress localAddress() { address = socketAdressOverride(LOCAL_ADDRESS_OVERRIDE); if (address == null) { address = channelLocalAddress(); + if (address != null && address.isDomainSocket() && address.path().isEmpty()) { + address = channelRemoteAddress(); + } } if (address != null) { localAddress = address; diff --git a/src/test/java/io/vertx/core/net/NetTest.java b/src/test/java/io/vertx/core/net/NetTest.java index d7e0604b97a..902d49b0329 100755 --- a/src/test/java/io/vertx/core/net/NetTest.java +++ b/src/test/java/io/vertx/core/net/NetTest.java @@ -2215,7 +2215,7 @@ public void testSocketAddress() { assertEquals("127.0.0.1", addr.hostAddress()); } else { assertEquals(testAddress.path(), addr.path()); - assertEquals("", socket.remoteAddress().path()); + assertEquals(testAddress.path(), socket.remoteAddress().path()); } socket.close(); }).listen(1234, "localhost").onComplete(onSuccess(v -> { @@ -2228,7 +2228,7 @@ public void testSocketAddress() { assertEquals(addr.port(), 1234); } else { assertEquals(testAddress.path(), addr.path()); - assertEquals("", socket.localAddress().path()); + assertEquals(testAddress.path(), socket.localAddress().path()); } socket.closeHandler(v2 -> testComplete()); }));