This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit aa2c0c3687da0ee0bfedd8c0721a844b5c8a535d
Author: Claude <[email protected]>
AuthorDate: Mon Oct 26 09:17:58 2026 +0000

    CAMEL-26108: camel-avro-rpc - address review comments
    
    Use 127.0.0.2 in the test instead of looking up a non-loopback address, so 
it always runs, and remove trailing whitespace in the upgrade guide.
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
---
 .../component/avro/AvroHttpConsumerHostTest.java   | 33 ++++------------------
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc    |  2 +-
 2 files changed, 6 insertions(+), 29 deletions(-)

diff --git 
a/components/camel-avro-rpc/camel-avro-rpc-component/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerHostTest.java
 
b/components/camel-avro-rpc/camel-avro-rpc-component/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerHostTest.java
index 53253fc2d534..7706cc6d58dc 100644
--- 
a/components/camel-avro-rpc/camel-avro-rpc-component/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerHostTest.java
+++ 
b/components/camel-avro-rpc/camel-avro-rpc-component/src/test/java/org/apache/camel/component/avro/AvroHttpConsumerHostTest.java
@@ -17,19 +17,14 @@
 package org.apache.camel.component.avro;
 
 import java.io.IOException;
-import java.net.Inet4Address;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
-import java.net.NetworkInterface;
 import java.net.Socket;
-import java.net.SocketException;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 /**
  * The http consumer listens on the host of the endpoint, as the netty 
consumer does.
@@ -49,32 +44,14 @@ public class AvroHttpConsumerHostTest extends 
AvroTestSupport {
     }
 
     @Test
-    public void testListensOnConfiguredHostOnly() throws Exception {
-        InetAddress other = findNonLoopbackAddress();
-        assumeTrue(other != null, "No non-loopback IPv4 address available");
-
-        assertDoesNotThrow(() -> connect(InetAddress.getByName("127.0.0.1")));
-        assertThrows(IOException.class, () -> connect(other));
+    public void testListensOnConfiguredHostOnly() {
+        assertDoesNotThrow(() -> connect("127.0.0.1"));
+        assertThrows(IOException.class, () -> connect("127.0.0.2"));
     }
 
-    private void connect(InetAddress address) throws IOException {
+    private void connect(String host) throws IOException {
         try (Socket socket = new Socket()) {
-            socket.connect(new InetSocketAddress(address, avroPort), 2000);
+            socket.connect(new InetSocketAddress(host, avroPort), 2000);
         }
     }
-
-    private static InetAddress findNonLoopbackAddress() throws SocketException 
{
-        return NetworkInterface.networkInterfaces()
-                .filter(nic -> {
-                    try {
-                        return nic.isUp() && !nic.isLoopback();
-                    } catch (SocketException e) {
-                        return false;
-                    }
-                })
-                .flatMap(NetworkInterface::inetAddresses)
-                .filter(address -> address instanceof Inet4Address && 
!address.isLoopbackAddress())
-                .findFirst()
-                .orElse(null);
-    }
 }
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index f7d1af58c7e2..9af133837d12 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -3576,7 +3576,7 @@ endpoint used directly in `from` still fails at startup: 
wrap it with the webhoo
 
 === camel-avro-rpc - the http consumer listens on the host of the endpoint
 
-The `avro:http` consumer now uses the host of the endpoint URI 
(`avro:http:[host]:[port]`) for its HTTP server, as the `avro:netty` consumer 
does. 
+The `avro:http` consumer now uses the host of the endpoint URI 
(`avro:http:[host]:[port]`) for its HTTP server, as the `avro:netty` consumer 
does.
 
 Use `0.0.0.0` as the host to accept connections on all network interfaces.
 

Reply via email to