[infinispan-commits] Infinispan SVN: r750 - trunk/core/src/test/java/org/infinispan/test/fwk.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Aug 31 06:11:58 EDT 2009


Author: mircea.markus
Date: 2009-08-31 06:11:58 -0400 (Mon, 31 Aug 2009)
New Revision: 750

Modified:
   trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java
Log:
added new test

Modified: trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java	2009-08-29 14:59:43 UTC (rev 749)
+++ trunk/core/src/test/java/org/infinispan/test/fwk/TcpMPingEnvironmentTest.java	2009-08-31 10:11:58 UTC (rev 750)
@@ -11,10 +11,13 @@
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.MulticastSocket;
+import java.net.NetworkInterface;
 import java.net.SocketAddress;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
+import java.util.Enumeration;
+import java.io.IOException;
 
 /**
  * The purpose of this class is to test that/if tcp + mping works fine in the given environment.
@@ -91,7 +94,45 @@
       }
    }
 
+   public void testMcastSocketCreation2() throws Exception {
+      InetAddress mcast_addr = InetAddress.getByName("228.10.10.5");
+      int port = 43589;
+      MulticastSocket retval = null;
+      try {
+         success = false;
+         Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
+         StringBuilder trace = new StringBuilder();
+         while (nis.hasMoreElements()) {
+            retval = new MulticastSocket(port);
+            NetworkInterface networkInterface = nis.nextElement();
+            retval.setNetworkInterface(networkInterface);
+            try {
+               retval.joinGroup(mcast_addr);
+            } catch (IOException e) {
+               String msg = "Failed to bind to " + networkInterface + ". Successfull ones were: " + trace;
+               log.error(msg);
+               throw new RuntimeException(msg);
 
+            }
+            String msg = "Successfully bind to " + networkInterface;
+            log.info(msg);
+            System.out.println(msg);
+            trace.append(msg).append('\n');
+         }
+         success = true;
+         System.out.println("trace = " + trace);
+      } finally {
+         if (retval != null) {
+            try {
+               retval.close();
+            } catch (Exception e) {
+               e.printStackTrace();
+            }
+         }
+      }
+   }
+
+
    private void expectView(JChannel... channels) throws Exception {
       for (int i = 0; i < 20; i++) {
          boolean success = true;



More information about the infinispan-commits mailing list