You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2023/02/15 10:09:29 UTC

[cxf] 04/04: Update to use non-depracated APIs

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

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

commit 751980b26229ae7bb3bc239ac18f9b74bb7ecf8c
Author: Daniel Kulp <da...@kulp.com>
AuthorDate: Wed Feb 15 10:57:16 2023 +0100

    Update to use non-depracated APIs
---
 .../java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
index 8b520d3574..eac0772155 100644
--- a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
+++ b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
@@ -22,10 +22,12 @@ package org.apache.cxf.ws.discovery;
 import java.io.InputStream;
 import java.net.DatagramPacket;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.InterfaceAddress;
 import java.net.MulticastSocket;
 import java.net.NetworkInterface;
 import java.net.SocketAddress;
+import java.net.StandardSocketOptions;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Enumeration;
@@ -114,10 +116,11 @@ public final class WSDiscoveryClientTest {
                     InetAddress address = InetAddress.getByName("239.255.255.250");
                     MulticastSocket s = new MulticastSocket(Integer.parseInt(PORT));
                     s.setBroadcast(true);
-                    s.setNetworkInterface(findIpv4Interface());
-                    s.setLoopbackMode(false);
+                    NetworkInterface ni = findIpv4Interface();
+                    s.setNetworkInterface(ni);
+                    s.setOption(StandardSocketOptions.IP_MULTICAST_LOOP, false);
                     s.setReuseAddress(true);
-                    s.joinGroup(address);
+                    s.joinGroup(new InetSocketAddress(address, 0), ni);
                     s.setReceiveBufferSize(64 * 1024);
                     s.setSoTimeout(5000);
                     byte[] bytes = new byte[64 * 1024];