You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2007/03/21 09:44:07 UTC

svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Author: apetrenko
Date: Wed Mar 21 01:44:06 2007
New Revision: 520804

URL: http://svn.apache.org/viewvc?view=rev&rev=520804
Log:
Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common?view=diff&rev=520804&r1=520803&r2=520804
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common Wed Mar 21 01:44:06 2007
@@ -1,4 +1,3 @@
-tests/api/java/net/MulticastSocketTest.java
 tests/api/java/net/URLClassLoaderTest.java
 tests/api/java/net/URLConnectionTest.java
 tests/api/java/net/URLTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl?view=diff&rev=520804&r1=520803&r2=520804
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl Wed Mar 21 01:44:06 2007
@@ -2,3 +2,4 @@
 org/apache/harmony/luni/tests/java/lang/ThreadTest.java
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
 tests/api/java/net/SocketTest.java
+tests/api/java/net/MulticastSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl?view=diff&rev=520804&r1=520803&r2=520804
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl Wed Mar 21 01:44:06 2007
@@ -0,0 +1 @@
+tests/api/java/net/MulticastSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java?view=diff&rev=520804&r1=520803&r2=520804
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java Wed Mar 21 01:44:06 2007
@@ -205,84 +205,77 @@
 	}
 
 	/**
+	 * @throws IOException 
 	 * @tests java.net.MulticastSocket#getNetworkInterface()
 	 */
-	public void test_getNetworkInterface() {
+	public void test_getNetworkInterface() throws IOException {
 		int groupPort = Support_PortManager.getNextPortForUDP();
-		try {
-			if (atLeastOneInterface) {
-
-				// validate that we get the expected response when one was not
-				// set
-				mss = new MulticastSocket(groupPort);
-				NetworkInterface theInterface = mss.getNetworkInterface();
-				assertNotNull(
-						"network interface returned wrong network interface when not set:"
-								+ theInterface,
-						theInterface.getInetAddresses());
-				InetAddress firstAddress = (InetAddress) theInterface
-						.getInetAddresses().nextElement();
-				// validate we the first address in the network interface is the
-				// ANY address
-				String preferIPv4StackValue = System
-						.getProperty("java.net.preferIPv4Stack");
-				String preferIPv6AddressesValue = System
-						.getProperty("java.net.preferIPv6Addresses");
-				if (((preferIPv4StackValue == null) || preferIPv4StackValue
-						.equalsIgnoreCase("false"))
-						&& (preferIPv6AddressesValue != null)
-						&& (preferIPv6AddressesValue.equals("true"))) {
-					assertTrue(
-							"network interface returned wrong network interface when not set:"
-									+ theInterface, InetAddress
-									.getByName("::0").equals(firstAddress));
-
-				} else {
-					assertTrue(
-							"network interface returned wrong network interface when not set:"
-									+ theInterface, InetAddress.getByName(
-									"0.0.0.0").equals(firstAddress));
-				}
-
-				mss.setNetworkInterface(networkInterface1);
-				assertTrue(
-						"getNetworkInterface did not return interface set by setNeworkInterface",
-						networkInterface1.equals(mss.getNetworkInterface()));
-
-				if (atLeastTwoInterfaces) {
-					mss.setNetworkInterface(networkInterface2);
-					assertTrue(
-							"getNetworkInterface did not return network interface set by second setNetworkInterface call",
-							networkInterface2.equals(mss.getNetworkInterface()));
-				}
-
-				groupPort = Support_PortManager.getNextPortForUDP();
-				mss = new MulticastSocket(groupPort);
-				if (IPV6networkInterface1 != null) {
-					mss.setNetworkInterface(IPV6networkInterface1);
-					assertTrue(
-							"getNetworkInterface did not return interface set by setNeworkInterface",
-							IPV6networkInterface1.equals(mss
-									.getNetworkInterface()));
-				}
-
-				// validate that we get the expected response when we set via
-				// setInterface
-				groupPort = Support_PortManager.getNextPortForUDP();
-				mss = new MulticastSocket(groupPort);
-				Enumeration addresses = networkInterface1.getInetAddresses();
-				if (addresses != null) {
-					firstAddress = (InetAddress) addresses.nextElement();
-					mss.setInterface(firstAddress);
-					assertTrue(
-							"getNetworkInterface did not return interface set by setInterface",
-							networkInterface1.equals(mss.getNetworkInterface()));
-				}
-			}
-		} catch (Exception e) {
-			fail("Exception during getNetworkInterface test: "
-					+ e.toString());
-		}
+		if (atLeastOneInterface) {
+            // validate that we get the expected response when one was not
+            // set
+            mss = new MulticastSocket(groupPort);
+            NetworkInterface theInterface = mss.getNetworkInterface();
+            assertNotNull(
+                    "network interface returned wrong network interface when not set:"
+                            + theInterface, theInterface.getInetAddresses());
+            InetAddress firstAddress = (InetAddress) theInterface
+                    .getInetAddresses().nextElement();
+            // validate we the first address in the network interface is the
+            // ANY address
+            String preferIPv4StackValue = System
+                    .getProperty("java.net.preferIPv4Stack");
+            String preferIPv6AddressesValue = System
+                    .getProperty("java.net.preferIPv6Addresses");
+            if (((preferIPv4StackValue == null) || preferIPv4StackValue
+                    .equalsIgnoreCase("false"))
+                    && (preferIPv6AddressesValue != null)
+                    && (preferIPv6AddressesValue.equals("true"))) {
+                assertTrue(
+                        "network interface returned wrong network interface when not set:"
+                                + theInterface, InetAddress.getByName("::0")
+                                .equals(firstAddress));
+
+            } else {
+                assertTrue(
+                        "network interface returned wrong network interface when not set:"
+                                + theInterface, InetAddress
+                                .getByName("0.0.0.0").equals(firstAddress));
+            }
+
+            mss.setNetworkInterface(networkInterface1);
+            assertTrue(
+                    "getNetworkInterface did not return interface set by setNeworkInterface",
+                    networkInterface1.equals(mss.getNetworkInterface()));
+
+            if (atLeastTwoInterfaces) {
+                mss.setNetworkInterface(networkInterface2);
+                assertTrue(
+                        "getNetworkInterface did not return network interface set by second setNetworkInterface call",
+                        networkInterface2.equals(mss.getNetworkInterface()));
+            }
+
+            groupPort = Support_PortManager.getNextPortForUDP();
+            mss = new MulticastSocket(groupPort);
+            if (IPV6networkInterface1 != null) {
+                mss.setNetworkInterface(IPV6networkInterface1);
+                assertTrue(
+                        "getNetworkInterface did not return interface set by setNeworkInterface",
+                        IPV6networkInterface1.equals(mss.getNetworkInterface()));
+            }
+
+            // validate that we get the expected response when we set via
+            // setInterface
+            groupPort = Support_PortManager.getNextPortForUDP();
+            mss = new MulticastSocket(groupPort);
+            Enumeration addresses = networkInterface1.getInetAddresses();
+            if (addresses != null) {
+                firstAddress = (InetAddress) addresses.nextElement();
+                mss.setInterface(firstAddress);
+                assertTrue(
+                        "getNetworkInterface did not return interface set by setInterface",
+                        networkInterface1.equals(mss.getNetworkInterface()));
+            }
+        }
 	}
 
 	/**
@@ -350,9 +343,11 @@
 	}
 
 	/**
+	 * @throws IOException 
+	 * @throws InterruptedException 
 	 * @tests java.net.MulticastSocket#joinGroup(java.net.SocketAddress,java.net.NetworkInterface)
 	 */
-	public void test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface() {
+	public void test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface() throws IOException, InterruptedException {
 		// security manager that allows us to check that we only return the
 		// addresses that we should
 		class mySecurityManager extends SecurityManager {
@@ -369,212 +364,201 @@
 		int groupPort = ports[0];
 		int serverPort = ports[1];
 
-		try {
 			Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
 
-			// first validate that we handle a null group ok
-			mss = new MulticastSocket(groupPort);
-			try {
-				mss.joinGroup(null, null);
-				fail("Did not get exception when group was null");
-			} catch (IllegalArgumentException e) {
-			}
-
-			// now validate we get the expected error if the address specified
-			// is not a multicast group
-			try {
-				groupSockAddr = new InetSocketAddress(InetAddress
-						.getByName("255.255.255.255"), groupPort);
-				mss.joinGroup(groupSockAddr, null);
-				fail("Did not get exception when group is not a multicast address");
-			} catch (IOException e) {
-			}
-
-			// now try to join a group if we are not authorized
-			// set the security manager that will make the first address not
-			// visible
-			System.setSecurityManager(new mySecurityManager());
-			try {
-				group = InetAddress.getByName("224.0.0.3");
-				groupSockAddr = new InetSocketAddress(group, groupPort);
-				mss.joinGroup(groupSockAddr, null);
-				fail( "Did not get exception when joining group is not allowed");
-			} catch (SecurityException e) {
-			}
-			System.setSecurityManager(null);
-
-			if (atLeastOneInterface) {
-				// now validate that we can properly join a group with a null
-				// network interface
-				ports = Support_PortManager.getNextPortsForUDP(2);
-				groupPort = ports[0];
-				serverPort = ports[1];
-				mss = new MulticastSocket(groupPort);
-				mss.joinGroup(groupSockAddr, null);
-				mss.setTimeToLive(2);
-				Thread.sleep(1000);
-
-				// set up the server and join the group on networkInterface1
-				group = InetAddress.getByName("224.0.0.3");
-				groupSockAddr = new InetSocketAddress(group, groupPort);
-				server = new MulticastServer(groupSockAddr, serverPort,
-						networkInterface1);
-				server.start();
-				Thread.sleep(1000);
-				msg = "Hello World";
-				DatagramPacket sdp = new DatagramPacket(msg.getBytes(), msg
-						.length(), group, serverPort);
-				mss.setTimeToLive(2);
-				mss.send(sdp);
-				Thread.sleep(1000);
-				// now vaildate that we received the data as expected
-				assertTrue("Group member did not recv data: ", new String(
-						server.rdp.getData(), 0, server.rdp.getLength())
-						.equals(msg));
-				server.stopServer();
-
-				// now validate that we handled the case were we join a
-				// different multicast address.
-				// verify we do not receive the data
-				ports = Support_PortManager.getNextPortsForUDP(2);
-				serverPort = ports[0];
-				server = new MulticastServer(groupSockAddr, serverPort,
-						networkInterface1);
-				server.start();
-				Thread.sleep(1000);
+        // first validate that we handle a null group ok
+        mss = new MulticastSocket(groupPort);
+        try {
+            mss.joinGroup(null, null);
+            fail("Did not get exception when group was null");
+        } catch (IllegalArgumentException e) {
+        }
 
-				groupPort = ports[1];
-				mss = new MulticastSocket(groupPort);
-				InetAddress group2 = InetAddress.getByName("224.0.0.4");
-				mss.setTimeToLive(10);
-				msg = "Hello World - Different Group";
-				sdp = new DatagramPacket(msg.getBytes(), msg.length(), group2,
-						serverPort);
-				mss.send(sdp);
-				Thread.sleep(1000);
-				assertFalse(
-						"Group member received data when sent on different group: ",
-						new String(server.rdp.getData(), 0, server.rdp
-								.getLength()).equals(msg));
-				server.stopServer();
-
-				// if there is more than one network interface then check that
-				// we can join on specific interfaces and that we only receive
-				// if data is received on that interface
-				if (atLeastTwoInterfaces) {
-					// set up server on first interfaces
-					NetworkInterface loopbackInterface = NetworkInterface
-							.getByInetAddress(InetAddress
-									.getByName("127.0.0.1"));
-
-					theInterfaces = NetworkInterface.getNetworkInterfaces();
-					while (theInterfaces.hasMoreElements()) {
-
-						NetworkInterface thisInterface = (NetworkInterface) theInterfaces
-								.nextElement();
-						if ((thisInterface.getInetAddresses() != null)
-								&& (Support_NetworkInterface
-										.useInterface(thisInterface) == true)) {
-							// get the first address on the interface
-
-							// start server which is joined to the group and has
-							// only asked for packets on this interface
-							Enumeration addresses = thisInterface
-									.getInetAddresses();
-
-							NetworkInterface sendingInterface = null;
-							boolean isLoopback = false;
-							if (addresses != null) {
-								InetAddress firstAddress = (InetAddress) addresses
-										.nextElement();
-								if (firstAddress.isLoopbackAddress()) {
-									isLoopback = true;
-								}
-								if (firstAddress instanceof Inet4Address) {
-									group = InetAddress.getByName("224.0.0.4");
-									if (networkInterface1
-											.equals(NetworkInterface
-													.getByInetAddress(InetAddress
-															.getByName("127.0.0.1")))) {
-										sendingInterface = networkInterface2;
-									} else {
-										sendingInterface = networkInterface1;
-									}
-								} else {
-									// if this interface only seems to support
-									// IPV6 addresses
-									group = InetAddress
-											.getByName("FF01:0:0:0:0:0:2:8001");
-									sendingInterface = IPV6networkInterface1;
-								}
-							}
-
-							InetAddress useAddress = null;
-							addresses = sendingInterface.getInetAddresses();
-							if ((addresses != null)
-									&& (addresses.hasMoreElements())) {
-								useAddress = (InetAddress) addresses
-										.nextElement();
-							}
-
-							ports = Support_PortManager.getNextPortsForUDP(2);
-							serverPort = ports[0];
-							groupPort = ports[1];
-							groupSockAddr = new InetSocketAddress(group,
-									serverPort);
-							server = new MulticastServer(groupSockAddr,
-									serverPort, thisInterface);
-							server.start();
-							Thread.sleep(1000);
-
-							// Now send out a package on interface
-							// networkInterface 1. We should
-							// only see the packet if we send it on interface 1
-							InetSocketAddress theAddress = new InetSocketAddress(
-									useAddress, groupPort);
-							mss = new MulticastSocket(groupPort);
-							mss.setNetworkInterface(sendingInterface);
-							msg = "Hello World - Again"
-									+ thisInterface.getName();
-							sdp = new DatagramPacket(msg.getBytes(), msg
-									.length(), group, serverPort);
-							mss.send(sdp);
-							Thread.sleep(1000);
-							if (thisInterface.equals(sendingInterface)) {
-								assertTrue(
-										"Group member did not recv data when bound on specific interface: ",
-										new String(server.rdp.getData(), 0,
-												server.rdp.getLength())
-												.equals(msg));
-							} else {
-								assertFalse(
-										"Group member received data on other interface when only asked for it on one interface: ",
-										new String(server.rdp.getData(), 0,
-												server.rdp.getLength())
-												.equals(msg));
-							}
+        // now validate we get the expected error if the address specified
+        // is not a multicast group
+        try {
+            groupSockAddr = new InetSocketAddress(InetAddress
+                    .getByName("255.255.255.255"), groupPort);
+            mss.joinGroup(groupSockAddr, null);
+            fail("Did not get exception when group is not a multicast address");
+        } catch (IOException e) {
+        }
 
-							server.stopServer();
-						}
-					}
+        // now try to join a group if we are not authorized
+        // set the security manager that will make the first address not
+        // visible
+        System.setSecurityManager(new mySecurityManager());
+        try {
+            group = InetAddress.getByName("224.0.0.3");
+            groupSockAddr = new InetSocketAddress(group, groupPort);
+            mss.joinGroup(groupSockAddr, null);
+            fail("Did not get exception when joining group is not allowed");
+        } catch (SecurityException e) {
+        }
+        System.setSecurityManager(null);
 
-					// validate that we can join the same address on two
-					// different interfaces but not on the same interface
-					groupPort = Support_PortManager.getNextPortForUDP();
-					mss = new MulticastSocket(groupPort);
-					mss.joinGroup(groupSockAddr, networkInterface1);
-					mss.joinGroup(groupSockAddr, networkInterface2);
-					try {
-						mss.joinGroup(groupSockAddr, networkInterface1);
-						fail(
-								"Did not get expected exception when joining for second time on same interface");
-					} catch (IOException e) {
-					}
-				}
-			}
-		} catch (Exception e) {
-			fail("Exception during joinGroup test: " + e.toString());
-		}
+        if (atLeastOneInterface) {
+            // now validate that we can properly join a group with a null
+            // network interface
+            ports = Support_PortManager.getNextPortsForUDP(2);
+            groupPort = ports[0];
+            serverPort = ports[1];
+            mss = new MulticastSocket(groupPort);
+            mss.joinGroup(groupSockAddr, null);
+            mss.setTimeToLive(2);
+            Thread.sleep(1000);
+
+            // set up the server and join the group on networkInterface1
+            group = InetAddress.getByName("224.0.0.3");
+            groupSockAddr = new InetSocketAddress(group, groupPort);
+            server = new MulticastServer(groupSockAddr, serverPort,
+                    networkInterface1);
+            server.start();
+            Thread.sleep(1000);
+            msg = "Hello World";
+            DatagramPacket sdp = new DatagramPacket(msg.getBytes(), msg
+                    .length(), group, serverPort);
+            mss.setTimeToLive(2);
+            mss.send(sdp);
+            Thread.sleep(1000);
+            // now vaildate that we received the data as expected
+            assertTrue("Group member did not recv data: ", new String(
+                    server.rdp.getData(), 0, server.rdp.getLength())
+                    .equals(msg));
+            server.stopServer();
+
+            // now validate that we handled the case were we join a
+            // different multicast address.
+            // verify we do not receive the data
+            ports = Support_PortManager.getNextPortsForUDP(2);
+            serverPort = ports[0];
+            server = new MulticastServer(groupSockAddr, serverPort,
+                    networkInterface1);
+            server.start();
+            Thread.sleep(1000);
+
+            groupPort = ports[1];
+            mss = new MulticastSocket(groupPort);
+            InetAddress group2 = InetAddress.getByName("224.0.0.4");
+            mss.setTimeToLive(10);
+            msg = "Hello World - Different Group";
+            sdp = new DatagramPacket(msg.getBytes(), msg.length(), group2,
+                    serverPort);
+            mss.send(sdp);
+            Thread.sleep(1000);
+            assertFalse(
+                    "Group member received data when sent on different group: ",
+                    new String(server.rdp.getData(), 0, server.rdp.getLength())
+                            .equals(msg));
+            server.stopServer();
+
+            // if there is more than one network interface then check that
+            // we can join on specific interfaces and that we only receive
+            // if data is received on that interface
+            if (atLeastTwoInterfaces) {
+                // set up server on first interfaces
+                NetworkInterface loopbackInterface = NetworkInterface
+                        .getByInetAddress(InetAddress.getByName("127.0.0.1"));
+
+                theInterfaces = NetworkInterface.getNetworkInterfaces();
+                while (theInterfaces.hasMoreElements()) {
+
+                    NetworkInterface thisInterface = (NetworkInterface) theInterfaces
+                            .nextElement();
+                    if ((thisInterface.getInetAddresses() != null && thisInterface
+                            .getInetAddresses().hasMoreElements())
+                            && (Support_NetworkInterface
+                                    .useInterface(thisInterface) == true)) {
+                        // get the first address on the interface
+
+                        // start server which is joined to the group and has
+                        // only asked for packets on this interface
+                        Enumeration addresses = thisInterface
+                                .getInetAddresses();
+
+                        NetworkInterface sendingInterface = null;
+                        boolean isLoopback = false;
+                        if (addresses != null) {
+                            InetAddress firstAddress = (InetAddress) addresses
+                                    .nextElement();
+                            if (firstAddress.isLoopbackAddress()) {
+                                isLoopback = true;
+                            }
+                            if (firstAddress instanceof Inet4Address) {
+                                group = InetAddress.getByName("224.0.0.4");
+                                if (networkInterface1.equals(NetworkInterface
+                                        .getByInetAddress(InetAddress
+                                                .getByName("127.0.0.1")))) {
+                                    sendingInterface = networkInterface2;
+                                } else {
+                                    sendingInterface = networkInterface1;
+                                }
+                            } else {
+                                // if this interface only seems to support
+                                // IPV6 addresses
+                                group = InetAddress
+                                        .getByName("FF01:0:0:0:0:0:2:8001");
+                                sendingInterface = IPV6networkInterface1;
+                            }
+                        }
+
+                        InetAddress useAddress = null;
+                        addresses = sendingInterface.getInetAddresses();
+                        if ((addresses != null)
+                                && (addresses.hasMoreElements())) {
+                            useAddress = (InetAddress) addresses.nextElement();
+                        }
+
+                        ports = Support_PortManager.getNextPortsForUDP(2);
+                        serverPort = ports[0];
+                        groupPort = ports[1];
+                        groupSockAddr = new InetSocketAddress(group, serverPort);
+                        server = new MulticastServer(groupSockAddr, serverPort,
+                                thisInterface);
+                        server.start();
+                        Thread.sleep(1000);
+
+                        // Now send out a package on interface
+                        // networkInterface 1. We should
+                        // only see the packet if we send it on interface 1
+                        InetSocketAddress theAddress = new InetSocketAddress(
+                                useAddress, groupPort);
+                        mss = new MulticastSocket(groupPort);
+                        mss.setNetworkInterface(sendingInterface);
+                        msg = "Hello World - Again" + thisInterface.getName();
+                        sdp = new DatagramPacket(msg.getBytes(), msg.length(),
+                                group, serverPort);
+                        mss.send(sdp);
+                        Thread.sleep(1000);
+                        if (thisInterface.equals(sendingInterface)) {
+                            assertTrue(
+                                    "Group member did not recv data when bound on specific interface: ",
+                                    new String(server.rdp.getData(), 0,
+                                            server.rdp.getLength()).equals(msg));
+                        } else {
+                            assertFalse(
+                                    "Group member received data on other interface when only asked for it on one interface: ",
+                                    new String(server.rdp.getData(), 0,
+                                            server.rdp.getLength()).equals(msg));
+                        }
+
+                        server.stopServer();
+                    }
+                }
+
+                // validate that we can join the same address on two
+                // different interfaces but not on the same interface
+                groupPort = Support_PortManager.getNextPortForUDP();
+                mss = new MulticastSocket(groupPort);
+                mss.joinGroup(groupSockAddr, networkInterface1);
+                mss.joinGroup(groupSockAddr, networkInterface2);
+                try {
+                    mss.joinGroup(groupSockAddr, networkInterface1);
+                    fail("Did not get expected exception when joining for second time on same interface");
+                } catch (IOException e) {
+                }
+            }
+        }
 		System.setSecurityManager(null);
 	}
 
@@ -805,101 +789,95 @@
 	}
 
 	/**
+	 * @throws IOException 
+	 * @throws InterruptedException 
 	 * @tests java.net.MulticastSocket#setNetworkInterface(java.net.NetworkInterface)
 	 */
-	public void test_setNetworkInterfaceLjava_net_NetworkInterface() {
+	public void test_setNetworkInterfaceLjava_net_NetworkInterface() throws IOException, InterruptedException {
 		String msg = null;
 		InetAddress group = null;
 		int[] ports = Support_PortManager.getNextPortsForUDP(2);
 		int groupPort = ports[0];
 		int serverPort = ports[1];
-		try {
-			if (atLeastOneInterface) {
-				// validate that null interface is handled ok
-				mss = new MulticastSocket(groupPort);
-
-				// this should through a socket exception to be compatible
-				try {
-					mss.setNetworkInterface(null);
-					fail(
-							"No socket exception when we set then network interface with NULL");
-				} catch (SocketException ex) {
-				}
-
-				// validate that we can get and set the interface
-				groupPort = Support_PortManager.getNextPortForUDP();
-				mss = new MulticastSocket(groupPort);
-				mss.setNetworkInterface(networkInterface1);
-				assertTrue(
-						"Interface did not seem to be set by setNeworkInterface",
-						networkInterface1.equals(mss.getNetworkInterface()));
-
-				// set up the server and join the group
-				group = InetAddress.getByName("224.0.0.3");
-
-				Enumeration theInterfaces = NetworkInterface
-						.getNetworkInterfaces();
-				while (theInterfaces.hasMoreElements()) {
-					NetworkInterface thisInterface = (NetworkInterface) theInterfaces
-							.nextElement();
-					if (thisInterface.getInetAddresses() != null) {
-						if ((!((InetAddress) thisInterface.getInetAddresses()
-								.nextElement()).isLoopbackAddress())
-								&&
-								// for windows we cannot use these pseudo
-								// interfaces for the test as the packets still
-								// come from the actual interface, not the
-								// Pseudo interface that was set
-								(Support_NetworkInterface
-										.useInterface(thisInterface) == true)) {
-							ports = Support_PortManager.getNextPortsForUDP(2);
-							serverPort = ports[0];
-							server = new MulticastServer(group, serverPort);
-							server.start();
-							// give the server some time to start up
-							Thread.sleep(1000);
-
-							// Send the packets on a particular interface. The
-							// source address in the received packet
-							// should be one of the addresses for the interface
-							// set
-							groupPort = ports[1];
-							mss = new MulticastSocket(groupPort);
-							mss.setNetworkInterface(thisInterface);
-							msg = thisInterface.getName();
-							byte theBytes[] = msg.getBytes();
-							DatagramPacket sdp = new DatagramPacket(theBytes,
-									theBytes.length, group, serverPort);
-							mss.send(sdp);
-							Thread.sleep(1000);
-							String receivedMessage = new String(server.rdp
-									.getData(), 0, server.rdp.getLength());
-							assertTrue(
-									"Group member did not recv data when send on a specific interface: ",
-									receivedMessage.equals(msg));
-							assertTrue(
-									"Datagram was not received from expected interface expected["
-											+ thisInterface
-											+ "] got ["
-											+ NetworkInterface
-													.getByInetAddress(server.rdp
-															.getAddress())
-											+ "]", NetworkInterface
-											.getByInetAddress(
-													server.rdp.getAddress())
-											.equals(thisInterface));
-
-							// stop the server
-							server.stopServer();
-						}
-					}
-				}
-			}
-			;
-		} catch (Exception e) {
-			fail("Exception during setNetworkInterface test: "
-					+ e.toString());
-		}
+		if (atLeastOneInterface) {
+            // validate that null interface is handled ok
+            mss = new MulticastSocket(groupPort);
+
+            // this should through a socket exception to be compatible
+            try {
+                mss.setNetworkInterface(null);
+                fail("No socket exception when we set then network interface with NULL");
+            } catch (SocketException ex) {
+            }
+
+            // validate that we can get and set the interface
+            groupPort = Support_PortManager.getNextPortForUDP();
+            mss = new MulticastSocket(groupPort);
+            mss.setNetworkInterface(networkInterface1);
+            assertTrue(
+                    "Interface did not seem to be set by setNeworkInterface",
+                    networkInterface1.equals(mss.getNetworkInterface()));
+
+            // set up the server and join the group
+            group = InetAddress.getByName("224.0.0.3");
+
+            Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
+            while (theInterfaces.hasMoreElements()) {
+                NetworkInterface thisInterface = (NetworkInterface) theInterfaces
+                        .nextElement();
+                if (thisInterface.getInetAddresses() != null
+                        && thisInterface.getInetAddresses().hasMoreElements()) {
+                    if ((!((InetAddress) thisInterface.getInetAddresses()
+                            .nextElement()).isLoopbackAddress())
+                            &&
+                            // for windows we cannot use these pseudo
+                            // interfaces for the test as the packets still
+                            // come from the actual interface, not the
+                            // Pseudo interface that was set
+                            (Support_NetworkInterface
+                                    .useInterface(thisInterface) == true)) {
+                        ports = Support_PortManager.getNextPortsForUDP(2);
+                        serverPort = ports[0];
+                        server = new MulticastServer(group, serverPort);
+                        server.start();
+                        // give the server some time to start up
+                        Thread.sleep(1000);
+
+                        // Send the packets on a particular interface. The
+                        // source address in the received packet
+                        // should be one of the addresses for the interface
+                        // set
+                        groupPort = ports[1];
+                        mss = new MulticastSocket(groupPort);
+                        mss.setNetworkInterface(thisInterface);
+                        msg = thisInterface.getName();
+                        byte theBytes[] = msg.getBytes();
+                        DatagramPacket sdp = new DatagramPacket(theBytes,
+                                theBytes.length, group, serverPort);
+                        mss.send(sdp);
+                        Thread.sleep(1000);
+                        String receivedMessage = new String(server.rdp
+                                .getData(), 0, server.rdp.getLength());
+                        assertTrue(
+                                "Group member did not recv data when send on a specific interface: ",
+                                receivedMessage.equals(msg));
+                        assertTrue(
+                                "Datagram was not received from expected interface expected["
+                                        + thisInterface
+                                        + "] got ["
+                                        + NetworkInterface
+                                                .getByInetAddress(server.rdp
+                                                        .getAddress()) + "]",
+                                NetworkInterface.getByInetAddress(
+                                        server.rdp.getAddress()).equals(
+                                        thisInterface));
+
+                        // stop the server
+                        server.stopServer();
+                    }
+                }
+            }
+        }
 	}
 
 	/**
@@ -1143,31 +1121,35 @@
 
 			atLeastOneInterface = false;
 			while (theInterfaces.hasMoreElements()
-					&& (atLeastOneInterface == false)) {
-				networkInterface1 = (NetworkInterface) theInterfaces
-						.nextElement();
-				if ((networkInterface1.getInetAddresses() != null) &&
-				// we only want real interfaces
-						(Support_NetworkInterface
-								.useInterface(networkInterface1) == true)) {
-					atLeastOneInterface = true;
-				}
-			}
+                    && (atLeastOneInterface == false)) {
+                networkInterface1 = (NetworkInterface) theInterfaces
+                        .nextElement();
+                if ((networkInterface1.getInetAddresses() != null)
+                        && networkInterface1.getInetAddresses()
+                                .hasMoreElements() &&
+                        // we only want real interfaces
+                        (Support_NetworkInterface
+                                .useInterface(networkInterface1) == true)) {
+                    atLeastOneInterface = true;
+                }
+            }
 
 			atLeastTwoInterfaces = false;
 			if (theInterfaces.hasMoreElements()) {
-				while (theInterfaces.hasMoreElements()
-						&& (atLeastTwoInterfaces == false)) {
-					networkInterface2 = (NetworkInterface) theInterfaces
-							.nextElement();
-					if ((networkInterface2.getInetAddresses() != null) &&
-					// we only want real interfaces
-							(Support_NetworkInterface
-									.useInterface(networkInterface2) == true)) {
-						atLeastTwoInterfaces = true;
-					}
-				}
-			}
+                while (theInterfaces.hasMoreElements()
+                        && (atLeastTwoInterfaces == false)) {
+                    networkInterface2 = (NetworkInterface) theInterfaces
+                            .nextElement();
+                    if ((networkInterface2.getInetAddresses() != null)
+                            && networkInterface2.getInetAddresses()
+                                    .hasMoreElements() &&
+                            // we only want real interfaces
+                            (Support_NetworkInterface
+                                    .useInterface(networkInterface2) == true)) {
+                        atLeastTwoInterfaces = true;
+                    }
+                }
+            }
 
 			Enumeration addresses;
 



Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexey Petrenko <al...@gmail.com>.
I can not reproduce MulticastSocketTest failure on my Windows and Linux boxes.
I've also contacted Vladimir Ivanov (who runs CCs) and he says that
there is no problems with this test on CC machines too.

SY, Alexey

2007/3/21, Alexei Zakharov <al...@gmail.com>:
> Hi Alexey,
>
> MulticastSocketTest fails each time I run luni tests. At least on
> Linux. And it seems CC encounters the same issue.
>
> Regards,
>
> 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > oops...
> > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> >
> > SY, Alexey
> >
> > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > Author: apetrenko
> > > Date: Wed Mar 21 01:44:06 2007
> > > New Revision: 520804
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > Log:
> > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > >
> > > Modified:
> > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
>
> --
> Alexei Zakharov,
> Intel ESSD
>

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexey Varlamov <al...@gmail.com>.
2007/3/24, Alexei Zakharov <al...@gmail.com>:
> Things become more interesting. With my current firewall configuration
> it passes on IBM VME and fails on DRLVM (on Linux). :-/
>
> Stacktraces:
> ---
> test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface:
> junit.framework.AssertionFailedError: Did not get expected exception
> when joining for second time on same interface at
> tests.api.java.net.MulticastSocketTest.test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface(MulticastSocketTest.java:557)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
>
> test_leaveGroupLjava_net_InetAddress
> junit.framework.AssertionFailedError: Failed to throw exception
> leaving non-member group at
> tests.api.java.net.MulticastSocketTest.test_leaveGroupLjava_net_InetAddress(MulticastSocketTest.java:595)
> at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
> ---
>
> Guess this is not a firewall issue. Some problems with luni natives -
> DatagramSocketImpl doesn't throw required exception? Any ideas?

This might be JIT-related problem - you can try to constrain execution
mode to run with JET or OPT only to localize. Simply put mode args to
<jre>/bin/default/harmonyvm.properties, either -Xem:jet or -Xem:opt or
-Xem:interpreter and run the tests.
Well, theoretically there is simpler way to supply extra args to VM,
via hy.test.vmargs property - but AFAIK it works not for all modules
(HARMONY-3311).

--
Alexey

>
> Regards,
>
> 2007/3/22, Alexey Petrenko <al...@gmail.com>:
> > I've tested on Windows and Linux behind our firewalls.
> > And I believe that CC machines are behind the firewall too.
> >
> > SY, Alexey
> >
> > 2007/3/22, Alexei Zakharov <al...@gmail.com>:
> > > Well, I've just tried to run this test on my Windows laptop with
> > > direct connection to internet - everything works just fine. So I
> > > believe this was a firewall problem indeed. IMO it worths mentioning
> > > somewhere on Wiki and / or site.
> > >
> > > Thanks,
> > >
> > > 2007/3/22, Tony Wu <wu...@gmail.com>:
> > > > Hi Alexei,
> > > > 3 Multicast IP addresses were used in this tests. so you should set
> > > > all of them as ACCPET( 224.0.0.3, 224.0.0.4 and 224.1.2.3) into your
> > > > iptables.
> > > >
> > > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > > The same picture for 224.1.2.3 :(
> > > > >
> > > > > 2007/3/22, Tony Wu <wu...@gmail.com>:
> > > > > > sorry I mean,
> > > > > > iptables -A HYBLD -d 224.1.2.3 -j ACCEPT
> > > > >
> > > > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > > > plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > > > >
> > > > > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > > > > Hi,
> > > > > > > > It caused by my patch on harmony-3433.
> > > > > > > >
> > > > > > > > It will fail on some machines because of firewall, the access to some
> > > > > > > > multicast addresses used in tests are not permitted on your machines.
> > > > > > > > running following lines will help,
> > > > > > > > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > > > > > > > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > > > > >
> > > > > > > > In the meanwhile I was thinking about is there any way to avoid this
> > > > > > > > operation, because asking user to set up a rule for testing is always
> > > > > > > > not a good idea. Do you have any suggestion? Thanks.
> > > > > > > >
> > > > > > > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > > > > > > Hi Alexey,
> > > > > > > > >
> > > > > > > > > MulticastSocketTest fails each time I run luni tests. At least on
> > > > > > > > > Linux. And it seems CC encounters the same issue.
> > > > > > > > >
> > > > > > > > > Regards,
> > > > > > > > >
> > > > > > > > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > > > > > > > oops...
> > > > > > > > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > > > > > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > > > > > > > >
> > > > > > > > > > SY, Alexey
> > > > > > > > > >
> > > > > > > > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > > > > > > > Author: apetrenko
> > > > > > > > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > > > > > > > New Revision: 520804
> > > > > > > > > > >
> > > > > > > > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > > > > > > > Log:
> > > > > > > > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > > > > > > > >
> > > > > > > > > > > Modified:
> > > > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
>
>
>
> --
> Alexei Zakharov,
> Intel ESSD
>

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexei Zakharov <al...@gmail.com>.
Things become more interesting. With my current firewall configuration
it passes on IBM VME and fails on DRLVM (on Linux). :-/

Stacktraces:
---
test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface:
junit.framework.AssertionFailedError: Did not get expected exception
when joining for second time on same interface at
tests.api.java.net.MulticastSocketTest.test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface(MulticastSocketTest.java:557)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)

test_leaveGroupLjava_net_InetAddress
junit.framework.AssertionFailedError: Failed to throw exception
leaving non-member group at
tests.api.java.net.MulticastSocketTest.test_leaveGroupLjava_net_InetAddress(MulticastSocketTest.java:595)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
---

Guess this is not a firewall issue. Some problems with luni natives -
DatagramSocketImpl doesn't throw required exception? Any ideas?

Regards,

2007/3/22, Alexey Petrenko <al...@gmail.com>:
> I've tested on Windows and Linux behind our firewalls.
> And I believe that CC machines are behind the firewall too.
>
> SY, Alexey
>
> 2007/3/22, Alexei Zakharov <al...@gmail.com>:
> > Well, I've just tried to run this test on my Windows laptop with
> > direct connection to internet - everything works just fine. So I
> > believe this was a firewall problem indeed. IMO it worths mentioning
> > somewhere on Wiki and / or site.
> >
> > Thanks,
> >
> > 2007/3/22, Tony Wu <wu...@gmail.com>:
> > > Hi Alexei,
> > > 3 Multicast IP addresses were used in this tests. so you should set
> > > all of them as ACCPET( 224.0.0.3, 224.0.0.4 and 224.1.2.3) into your
> > > iptables.
> > >
> > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > The same picture for 224.1.2.3 :(
> > > >
> > > > 2007/3/22, Tony Wu <wu...@gmail.com>:
> > > > > sorry I mean,
> > > > > iptables -A HYBLD -d 224.1.2.3 -j ACCEPT
> > > >
> > > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > > plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > > >
> > > > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > > > Hi,
> > > > > > > It caused by my patch on harmony-3433.
> > > > > > >
> > > > > > > It will fail on some machines because of firewall, the access to some
> > > > > > > multicast addresses used in tests are not permitted on your machines.
> > > > > > > running following lines will help,
> > > > > > > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > > > > > > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > > > >
> > > > > > > In the meanwhile I was thinking about is there any way to avoid this
> > > > > > > operation, because asking user to set up a rule for testing is always
> > > > > > > not a good idea. Do you have any suggestion? Thanks.
> > > > > > >
> > > > > > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > > > > > Hi Alexey,
> > > > > > > >
> > > > > > > > MulticastSocketTest fails each time I run luni tests. At least on
> > > > > > > > Linux. And it seems CC encounters the same issue.
> > > > > > > >
> > > > > > > > Regards,
> > > > > > > >
> > > > > > > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > > > > > > oops...
> > > > > > > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > > > > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > > > > > > >
> > > > > > > > > SY, Alexey
> > > > > > > > >
> > > > > > > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > > > > > > Author: apetrenko
> > > > > > > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > > > > > > New Revision: 520804
> > > > > > > > > >
> > > > > > > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > > > > > > Log:
> > > > > > > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > > > > > > >
> > > > > > > > > > Modified:
> > > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl



-- 
Alexei Zakharov,
Intel ESSD

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexey Petrenko <al...@gmail.com>.
I've tested on Windows and Linux behind our firewalls.
And I believe that CC machines are behind the firewall too.

SY, Alexey

2007/3/22, Alexei Zakharov <al...@gmail.com>:
> Well, I've just tried to run this test on my Windows laptop with
> direct connection to internet - everything works just fine. So I
> believe this was a firewall problem indeed. IMO it worths mentioning
> somewhere on Wiki and / or site.
>
> Thanks,
>
> 2007/3/22, Tony Wu <wu...@gmail.com>:
> > Hi Alexei,
> > 3 Multicast IP addresses were used in this tests. so you should set
> > all of them as ACCPET( 224.0.0.3, 224.0.0.4 and 224.1.2.3) into your
> > iptables.
> >
> > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > The same picture for 224.1.2.3 :(
> > >
> > > 2007/3/22, Tony Wu <wu...@gmail.com>:
> > > > sorry I mean,
> > > > iptables -A HYBLD -d 224.1.2.3 -j ACCEPT
> > >
> > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > >
> > > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > > Hi,
> > > > > > It caused by my patch on harmony-3433.
> > > > > >
> > > > > > It will fail on some machines because of firewall, the access to some
> > > > > > multicast addresses used in tests are not permitted on your machines.
> > > > > > running following lines will help,
> > > > > > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > > > > > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > > >
> > > > > > In the meanwhile I was thinking about is there any way to avoid this
> > > > > > operation, because asking user to set up a rule for testing is always
> > > > > > not a good idea. Do you have any suggestion? Thanks.
> > > > > >
> > > > > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > > > > Hi Alexey,
> > > > > > >
> > > > > > > MulticastSocketTest fails each time I run luni tests. At least on
> > > > > > > Linux. And it seems CC encounters the same issue.
> > > > > > >
> > > > > > > Regards,
> > > > > > >
> > > > > > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > > > > > oops...
> > > > > > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > > > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > > > > > >
> > > > > > > > SY, Alexey
> > > > > > > >
> > > > > > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > > > > > Author: apetrenko
> > > > > > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > > > > > New Revision: 520804
> > > > > > > > >
> > > > > > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > > > > > Log:
> > > > > > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > > > > > >
> > > > > > > > > Modified:
> > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
>
> --
> Alexei Zakharov,
> Intel ESSD
>

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexei Zakharov <al...@gmail.com>.
Well, I've just tried to run this test on my Windows laptop with
direct connection to internet - everything works just fine. So I
believe this was a firewall problem indeed. IMO it worths mentioning
somewhere on Wiki and / or site.

Thanks,

2007/3/22, Tony Wu <wu...@gmail.com>:
> Hi Alexei,
> 3 Multicast IP addresses were used in this tests. so you should set
> all of them as ACCPET( 224.0.0.3, 224.0.0.4 and 224.1.2.3) into your
> iptables.
>
> On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > The same picture for 224.1.2.3 :(
> >
> > 2007/3/22, Tony Wu <wu...@gmail.com>:
> > > sorry I mean,
> > > iptables -A HYBLD -d 224.1.2.3 -j ACCEPT
> >
> > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > >
> > > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > > Hi,
> > > > > It caused by my patch on harmony-3433.
> > > > >
> > > > > It will fail on some machines because of firewall, the access to some
> > > > > multicast addresses used in tests are not permitted on your machines.
> > > > > running following lines will help,
> > > > > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > > > > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > > >
> > > > > In the meanwhile I was thinking about is there any way to avoid this
> > > > > operation, because asking user to set up a rule for testing is always
> > > > > not a good idea. Do you have any suggestion? Thanks.
> > > > >
> > > > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > > > Hi Alexey,
> > > > > >
> > > > > > MulticastSocketTest fails each time I run luni tests. At least on
> > > > > > Linux. And it seems CC encounters the same issue.
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > > > > oops...
> > > > > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > > > > >
> > > > > > > SY, Alexey
> > > > > > >
> > > > > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > > > > Author: apetrenko
> > > > > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > > > > New Revision: 520804
> > > > > > > >
> > > > > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > > > > Log:
> > > > > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > > > > >
> > > > > > > > Modified:
> > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl

-- 
Alexei Zakharov,
Intel ESSD

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Tony Wu <wu...@gmail.com>.
Hi Alexei,
3 Multicast IP addresses were used in this tests. so you should set
all of them as ACCPET( 224.0.0.3, 224.0.0.4 and 224.1.2.3) into your
iptables.

On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> The same picture for 224.1.2.3 :(
>
> 2007/3/22, Tony Wu <wu...@gmail.com>:
> > sorry I mean,
> > iptables -A HYBLD -d 224.1.2.3 -j ACCEPT
> >
> > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > >
> > > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > > Hi,
> > > > It caused by my patch on harmony-3433.
> > > >
> > > > It will fail on some machines because of firewall, the access to some
> > > > multicast addresses used in tests are not permitted on your machines.
> > > > running following lines will help,
> > > > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > > > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > > >
> > > > In the meanwhile I was thinking about is there any way to avoid this
> > > > operation, because asking user to set up a rule for testing is always
> > > > not a good idea. Do you have any suggestion? Thanks.
> > > >
> > > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > > Hi Alexey,
> > > > >
> > > > > MulticastSocketTest fails each time I run luni tests. At least on
> > > > > Linux. And it seems CC encounters the same issue.
> > > > >
> > > > > Regards,
> > > > >
> > > > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > > > oops...
> > > > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > > > >
> > > > > > SY, Alexey
> > > > > >
> > > > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > > > Author: apetrenko
> > > > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > > > New Revision: 520804
> > > > > > >
> > > > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > > > Log:
> > > > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > > > >
> > > > > > > Modified:
> > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
>
> --
> Alexei Zakharov,
> Intel ESSD
>


-- 
Tony Wu
China Software Development Lab, IBM

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexei Zakharov <al...@gmail.com>.
The same picture for 224.1.2.3 :(

2007/3/22, Tony Wu <wu...@gmail.com>:
> sorry I mean,
> iptables -A HYBLD -d 224.1.2.3 -j ACCEPT
>
> On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> >
> > On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > > Hi,
> > > It caused by my patch on harmony-3433.
> > >
> > > It will fail on some machines because of firewall, the access to some
> > > multicast addresses used in tests are not permitted on your machines.
> > > running following lines will help,
> > > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> > >
> > > In the meanwhile I was thinking about is there any way to avoid this
> > > operation, because asking user to set up a rule for testing is always
> > > not a good idea. Do you have any suggestion? Thanks.
> > >
> > > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > Hi Alexey,
> > > >
> > > > MulticastSocketTest fails each time I run luni tests. At least on
> > > > Linux. And it seems CC encounters the same issue.
> > > >
> > > > Regards,
> > > >
> > > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > > oops...
> > > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > > >
> > > > > SY, Alexey
> > > > >
> > > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > > Author: apetrenko
> > > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > > New Revision: 520804
> > > > > >
> > > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > > Log:
> > > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > > >
> > > > > > Modified:
> > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl

-- 
Alexei Zakharov,
Intel ESSD

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Tony Wu <wu...@gmail.com>.
sorry I mean,
iptables -A HYBLD -d 224.1.2.3 -j ACCEPT

On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
>
> On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> > Hi,
> > It caused by my patch on harmony-3433.
> >
> > It will fail on some machines because of firewall, the access to some
> > multicast addresses used in tests are not permitted on your machines.
> > running following lines will help,
> > iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> > iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
> >
> > In the meanwhile I was thinking about is there any way to avoid this
> > operation, because asking user to set up a rule for testing is always
> > not a good idea. Do you have any suggestion? Thanks.
> >
> > On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > Hi Alexey,
> > >
> > > MulticastSocketTest fails each time I run luni tests. At least on
> > > Linux. And it seems CC encounters the same issue.
> > >
> > > Regards,
> > >
> > > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > > oops...
> > > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > > >
> > > > SY, Alexey
> > > >
> > > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > > Author: apetrenko
> > > > > Date: Wed Mar 21 01:44:06 2007
> > > > > New Revision: 520804
> > > > >
> > > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > > Log:
> > > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > > >
> > > > > Modified:
> > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
> > >
> > > --
> > > Alexei Zakharov,
> > > Intel ESSD
> > >
> >
> >
> > --
> > Tony Wu
> > China Software Development Lab, IBM
> >
>
>
> --
> Tony Wu
> China Software Development Lab, IBM
>


-- 
Tony Wu
China Software Development Lab, IBM

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Tony Wu <wu...@gmail.com>.
plus iptables -A HYBLD -d 224.0.0.4 -j ACCEPT

On 3/22/07, Tony Wu <wu...@gmail.com> wrote:
> Hi,
> It caused by my patch on harmony-3433.
>
> It will fail on some machines because of firewall, the access to some
> multicast addresses used in tests are not permitted on your machines.
> running following lines will help,
> iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
>
> In the meanwhile I was thinking about is there any way to avoid this
> operation, because asking user to set up a rule for testing is always
> not a good idea. Do you have any suggestion? Thanks.
>
> On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > Hi Alexey,
> >
> > MulticastSocketTest fails each time I run luni tests. At least on
> > Linux. And it seems CC encounters the same issue.
> >
> > Regards,
> >
> > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > oops...
> > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > >
> > > SY, Alexey
> > >
> > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > Author: apetrenko
> > > > Date: Wed Mar 21 01:44:06 2007
> > > > New Revision: 520804
> > > >
> > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > Log:
> > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > >
> > > > Modified:
> > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
> >
> > --
> > Alexei Zakharov,
> > Intel ESSD
> >
>
>
> --
> Tony Wu
> China Software Development Lab, IBM
>


-- 
Tony Wu
China Software Development Lab, IBM

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexei Zakharov <al...@gmail.com>.
Hi Tony,

Seems this doesn't help. Currently I have (iptables -L):

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             224.0.0.3
ACCEPT     all  --  anywhere             DVMRP.MCAST.NET
ACCEPT     all  --  DVMRP.MCAST.NET      anywhere
ACCEPT     all  --  224.0.0.3            anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             224.0.0.3
ACCEPT     all  --  anywhere             DVMRP.MCAST.NET

But I still can see two failures:
test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface
test_leaveGroupLjava_net_InetAddress

I guess packets are blocked by our corporate firewall I don't have a
control of. Is there any way to emulate this with our testing
infrastructure?

Regards,

2007/3/22, Tony Wu <wu...@gmail.com>:
> Hi,
> It caused by my patch on harmony-3433.
>
> It will fail on some machines because of firewall, the access to some
> multicast addresses used in tests are not permitted on your machines.
> running following lines will help,
> iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
> iptables -A HYBLD -d 224.0.0.4 -j ACCEPT
>
> In the meanwhile I was thinking about is there any way to avoid this
> operation, because asking user to set up a rule for testing is always
> not a good idea. Do you have any suggestion? Thanks.
>
> On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> > Hi Alexey,
> >
> > MulticastSocketTest fails each time I run luni tests. At least on
> > Linux. And it seems CC encounters the same issue.
> >
> > Regards,
> >
> > 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > > oops...
> > > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> > >
> > > SY, Alexey
> > >
> > > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > > Author: apetrenko
> > > > Date: Wed Mar 21 01:44:06 2007
> > > > New Revision: 520804
> > > >
> > > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > > Log:
> > > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > > >
> > > > Modified:
> > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl


-- 
Alexei Zakharov,
Intel ESSD

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Tony Wu <wu...@gmail.com>.
Hi,
It caused by my patch on harmony-3433.

It will fail on some machines because of firewall, the access to some
multicast addresses used in tests are not permitted on your machines.
running following lines will help,
iptables -A HYBLD -d 224.0.0.3 -j ACCEPT
iptables -A HYBLD -d 224.0.0.4 -j ACCEPT

In the meanwhile I was thinking about is there any way to avoid this
operation, because asking user to set up a rule for testing is always
not a good idea. Do you have any suggestion? Thanks.

On 3/22/07, Alexei Zakharov <al...@gmail.com> wrote:
> Hi Alexey,
>
> MulticastSocketTest fails each time I run luni tests. At least on
> Linux. And it seems CC encounters the same issue.
>
> Regards,
>
> 2007/3/21, Alexey Petrenko <al...@gmail.com>:
> > oops...
> > That's a patch for HARMONY-3433 "[classlib][luni]move out
> > src\test\java\tests\api\java\net\MulticastSocketTest.java"
> >
> > SY, Alexey
> >
> > 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > > Author: apetrenko
> > > Date: Wed Mar 21 01:44:06 2007
> > > New Revision: 520804
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > > Log:
> > > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> > >
> > > Modified:
> > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> > >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
>
> --
> Alexei Zakharov,
> Intel ESSD
>


-- 
Tony Wu
China Software Development Lab, IBM

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexei Zakharov <al...@gmail.com>.
Hi Alexey,

MulticastSocketTest fails each time I run luni tests. At least on
Linux. And it seems CC encounters the same issue.

Regards,

2007/3/21, Alexey Petrenko <al...@gmail.com>:
> oops...
> That's a patch for HARMONY-3433 "[classlib][luni]move out
> src\test\java\tests\api\java\net\MulticastSocketTest.java"
>
> SY, Alexey
>
> 2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> > Author: apetrenko
> > Date: Wed Mar 21 01:44:06 2007
> > New Revision: 520804
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> > Log:
> > Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
> >
> > Modified:
> >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> >    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl

-- 
Alexei Zakharov,
Intel ESSD

Re: svn commit: r520804 - in /harmony/enhanced/classlib/trunk/modules/luni: make/exclude.common make/exclude.linux.x86_64.drl make/exclude.windows.x86_64.drl src/test/java/tests/api/java/net/MulticastSocketTest.java

Posted by Alexey Petrenko <al...@gmail.com>.
oops...
That's a patch for HARMONY-3433 "[classlib][luni]move out
src\test\java\tests\api\java\net\MulticastSocketTest.java"

SY, Alexey

2007/3/21, apetrenko@apache.org <ap...@apache.org>:
> Author: apetrenko
> Date: Wed Mar 21 01:44:06 2007
> New Revision: 520804
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=520804
> Log:
> Patch for HARMONY-3454 "[classlib][swing] JEditorPane.createEditorKitForContentType() uses wrong classloader"
>
> Modified:
>    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
>    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
>    harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
>    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
>
> Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common?view=diff&rev=520804&r1=520803&r2=520804
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common (original)
> +++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.common Wed Mar 21 01:44:06 2007
> @@ -1,4 +1,3 @@
> -tests/api/java/net/MulticastSocketTest.java
>  tests/api/java/net/URLClassLoaderTest.java
>  tests/api/java/net/URLConnectionTest.java
>  tests/api/java/net/URLTest.java
>
> Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl?view=diff&rev=520804&r1=520803&r2=520804
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl (original)
> +++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.linux.x86_64.drl Wed Mar 21 01:44:06 2007
> @@ -2,3 +2,4 @@
>  org/apache/harmony/luni/tests/java/lang/ThreadTest.java
>  org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
>  tests/api/java/net/SocketTest.java
> +tests/api/java/net/MulticastSocketTest.java
>
> Modified: harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl?view=diff&rev=520804&r1=520803&r2=520804
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl (original)
> +++ harmony/enhanced/classlib/trunk/modules/luni/make/exclude.windows.x86_64.drl Wed Mar 21 01:44:06 2007
> @@ -0,0 +1 @@
> +tests/api/java/net/MulticastSocketTest.java
>
> Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java
> URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java?view=diff&rev=520804&r1=520803&r2=520804
> ==============================================================================
> --- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java (original)
> +++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/MulticastSocketTest.java Wed Mar 21 01:44:06 2007
> @@ -205,84 +205,77 @@
>        }
>
>        /**
> +        * @throws IOException
>         * @tests java.net.MulticastSocket#getNetworkInterface()
>         */
> -       public void test_getNetworkInterface() {
> +       public void test_getNetworkInterface() throws IOException {
>                int groupPort = Support_PortManager.getNextPortForUDP();
> -               try {
> -                       if (atLeastOneInterface) {
> -
> -                               // validate that we get the expected response when one was not
> -                               // set
> -                               mss = new MulticastSocket(groupPort);
> -                               NetworkInterface theInterface = mss.getNetworkInterface();
> -                               assertNotNull(
> -                                               "network interface returned wrong network interface when not set:"
> -                                                               + theInterface,
> -                                               theInterface.getInetAddresses());
> -                               InetAddress firstAddress = (InetAddress) theInterface
> -                                               .getInetAddresses().nextElement();
> -                               // validate we the first address in the network interface is the
> -                               // ANY address
> -                               String preferIPv4StackValue = System
> -                                               .getProperty("java.net.preferIPv4Stack");
> -                               String preferIPv6AddressesValue = System
> -                                               .getProperty("java.net.preferIPv6Addresses");
> -                               if (((preferIPv4StackValue == null) || preferIPv4StackValue
> -                                               .equalsIgnoreCase("false"))
> -                                               && (preferIPv6AddressesValue != null)
> -                                               && (preferIPv6AddressesValue.equals("true"))) {
> -                                       assertTrue(
> -                                                       "network interface returned wrong network interface when not set:"
> -                                                                       + theInterface, InetAddress
> -                                                                       .getByName("::0").equals(firstAddress));
> -
> -                               } else {
> -                                       assertTrue(
> -                                                       "network interface returned wrong network interface when not set:"
> -                                                                       + theInterface, InetAddress.getByName(
> -                                                                       "0.0.0.0").equals(firstAddress));
> -                               }
> -
> -                               mss.setNetworkInterface(networkInterface1);
> -                               assertTrue(
> -                                               "getNetworkInterface did not return interface set by setNeworkInterface",
> -                                               networkInterface1.equals(mss.getNetworkInterface()));
> -
> -                               if (atLeastTwoInterfaces) {
> -                                       mss.setNetworkInterface(networkInterface2);
> -                                       assertTrue(
> -                                                       "getNetworkInterface did not return network interface set by second setNetworkInterface call",
> -                                                       networkInterface2.equals(mss.getNetworkInterface()));
> -                               }
> -
> -                               groupPort = Support_PortManager.getNextPortForUDP();
> -                               mss = new MulticastSocket(groupPort);
> -                               if (IPV6networkInterface1 != null) {
> -                                       mss.setNetworkInterface(IPV6networkInterface1);
> -                                       assertTrue(
> -                                                       "getNetworkInterface did not return interface set by setNeworkInterface",
> -                                                       IPV6networkInterface1.equals(mss
> -                                                                       .getNetworkInterface()));
> -                               }
> -
> -                               // validate that we get the expected response when we set via
> -                               // setInterface
> -                               groupPort = Support_PortManager.getNextPortForUDP();
> -                               mss = new MulticastSocket(groupPort);
> -                               Enumeration addresses = networkInterface1.getInetAddresses();
> -                               if (addresses != null) {
> -                                       firstAddress = (InetAddress) addresses.nextElement();
> -                                       mss.setInterface(firstAddress);
> -                                       assertTrue(
> -                                                       "getNetworkInterface did not return interface set by setInterface",
> -                                                       networkInterface1.equals(mss.getNetworkInterface()));
> -                               }
> -                       }
> -               } catch (Exception e) {
> -                       fail("Exception during getNetworkInterface test: "
> -                                       + e.toString());
> -               }
> +               if (atLeastOneInterface) {
> +            // validate that we get the expected response when one was not
> +            // set
> +            mss = new MulticastSocket(groupPort);
> +            NetworkInterface theInterface = mss.getNetworkInterface();
> +            assertNotNull(
> +                    "network interface returned wrong network interface when not set:"
> +                            + theInterface, theInterface.getInetAddresses());
> +            InetAddress firstAddress = (InetAddress) theInterface
> +                    .getInetAddresses().nextElement();
> +            // validate we the first address in the network interface is the
> +            // ANY address
> +            String preferIPv4StackValue = System
> +                    .getProperty("java.net.preferIPv4Stack");
> +            String preferIPv6AddressesValue = System
> +                    .getProperty("java.net.preferIPv6Addresses");
> +            if (((preferIPv4StackValue == null) || preferIPv4StackValue
> +                    .equalsIgnoreCase("false"))
> +                    && (preferIPv6AddressesValue != null)
> +                    && (preferIPv6AddressesValue.equals("true"))) {
> +                assertTrue(
> +                        "network interface returned wrong network interface when not set:"
> +                                + theInterface, InetAddress.getByName("::0")
> +                                .equals(firstAddress));
> +
> +            } else {
> +                assertTrue(
> +                        "network interface returned wrong network interface when not set:"
> +                                + theInterface, InetAddress
> +                                .getByName("0.0.0.0").equals(firstAddress));
> +            }
> +
> +            mss.setNetworkInterface(networkInterface1);
> +            assertTrue(
> +                    "getNetworkInterface did not return interface set by setNeworkInterface",
> +                    networkInterface1.equals(mss.getNetworkInterface()));
> +
> +            if (atLeastTwoInterfaces) {
> +                mss.setNetworkInterface(networkInterface2);
> +                assertTrue(
> +                        "getNetworkInterface did not return network interface set by second setNetworkInterface call",
> +                        networkInterface2.equals(mss.getNetworkInterface()));
> +            }
> +
> +            groupPort = Support_PortManager.getNextPortForUDP();
> +            mss = new MulticastSocket(groupPort);
> +            if (IPV6networkInterface1 != null) {
> +                mss.setNetworkInterface(IPV6networkInterface1);
> +                assertTrue(
> +                        "getNetworkInterface did not return interface set by setNeworkInterface",
> +                        IPV6networkInterface1.equals(mss.getNetworkInterface()));
> +            }
> +
> +            // validate that we get the expected response when we set via
> +            // setInterface
> +            groupPort = Support_PortManager.getNextPortForUDP();
> +            mss = new MulticastSocket(groupPort);
> +            Enumeration addresses = networkInterface1.getInetAddresses();
> +            if (addresses != null) {
> +                firstAddress = (InetAddress) addresses.nextElement();
> +                mss.setInterface(firstAddress);
> +                assertTrue(
> +                        "getNetworkInterface did not return interface set by setInterface",
> +                        networkInterface1.equals(mss.getNetworkInterface()));
> +            }
> +        }
>        }
>
>        /**
> @@ -350,9 +343,11 @@
>        }
>
>        /**
> +        * @throws IOException
> +        * @throws InterruptedException
>         * @tests java.net.MulticastSocket#joinGroup(java.net.SocketAddress,java.net.NetworkInterface)
>         */
> -       public void test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface() {
> +       public void test_joinGroupLjava_net_SocketAddressLjava_net_NetworkInterface() throws IOException, InterruptedException {
>                // security manager that allows us to check that we only return the
>                // addresses that we should
>                class mySecurityManager extends SecurityManager {
> @@ -369,212 +364,201 @@
>                int groupPort = ports[0];
>                int serverPort = ports[1];
>
> -               try {
>                        Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
>
> -                       // first validate that we handle a null group ok
> -                       mss = new MulticastSocket(groupPort);
> -                       try {
> -                               mss.joinGroup(null, null);
> -                               fail("Did not get exception when group was null");
> -                       } catch (IllegalArgumentException e) {
> -                       }
> -
> -                       // now validate we get the expected error if the address specified
> -                       // is not a multicast group
> -                       try {
> -                               groupSockAddr = new InetSocketAddress(InetAddress
> -                                               .getByName("255.255.255.255"), groupPort);
> -                               mss.joinGroup(groupSockAddr, null);
> -                               fail("Did not get exception when group is not a multicast address");
> -                       } catch (IOException e) {
> -                       }
> -
> -                       // now try to join a group if we are not authorized
> -                       // set the security manager that will make the first address not
> -                       // visible
> -                       System.setSecurityManager(new mySecurityManager());
> -                       try {
> -                               group = InetAddress.getByName("224.0.0.3");
> -                               groupSockAddr = new InetSocketAddress(group, groupPort);
> -                               mss.joinGroup(groupSockAddr, null);
> -                               fail( "Did not get exception when joining group is not allowed");
> -                       } catch (SecurityException e) {
> -                       }
> -                       System.setSecurityManager(null);
> -
> -                       if (atLeastOneInterface) {
> -                               // now validate that we can properly join a group with a null
> -                               // network interface
> -                               ports = Support_PortManager.getNextPortsForUDP(2);
> -                               groupPort = ports[0];
> -                               serverPort = ports[1];
> -                               mss = new MulticastSocket(groupPort);
> -                               mss.joinGroup(groupSockAddr, null);
> -                               mss.setTimeToLive(2);
> -                               Thread.sleep(1000);
> -
> -                               // set up the server and join the group on networkInterface1
> -                               group = InetAddress.getByName("224.0.0.3");
> -                               groupSockAddr = new InetSocketAddress(group, groupPort);
> -                               server = new MulticastServer(groupSockAddr, serverPort,
> -                                               networkInterface1);
> -                               server.start();
> -                               Thread.sleep(1000);
> -                               msg = "Hello World";
> -                               DatagramPacket sdp = new DatagramPacket(msg.getBytes(), msg
> -                                               .length(), group, serverPort);
> -                               mss.setTimeToLive(2);
> -                               mss.send(sdp);
> -                               Thread.sleep(1000);
> -                               // now vaildate that we received the data as expected
> -                               assertTrue("Group member did not recv data: ", new String(
> -                                               server.rdp.getData(), 0, server.rdp.getLength())
> -                                               .equals(msg));
> -                               server.stopServer();
> -
> -                               // now validate that we handled the case were we join a
> -                               // different multicast address.
> -                               // verify we do not receive the data
> -                               ports = Support_PortManager.getNextPortsForUDP(2);
> -                               serverPort = ports[0];
> -                               server = new MulticastServer(groupSockAddr, serverPort,
> -                                               networkInterface1);
> -                               server.start();
> -                               Thread.sleep(1000);
> +        // first validate that we handle a null group ok
> +        mss = new MulticastSocket(groupPort);
> +        try {
> +            mss.joinGroup(null, null);
> +            fail("Did not get exception when group was null");
> +        } catch (IllegalArgumentException e) {
> +        }
>
> -                               groupPort = ports[1];
> -                               mss = new MulticastSocket(groupPort);
> -                               InetAddress group2 = InetAddress.getByName("224.0.0.4");
> -                               mss.setTimeToLive(10);
> -                               msg = "Hello World - Different Group";
> -                               sdp = new DatagramPacket(msg.getBytes(), msg.length(), group2,
> -                                               serverPort);
> -                               mss.send(sdp);
> -                               Thread.sleep(1000);
> -                               assertFalse(
> -                                               "Group member received data when sent on different group: ",
> -                                               new String(server.rdp.getData(), 0, server.rdp
> -                                                               .getLength()).equals(msg));
> -                               server.stopServer();
> -
> -                               // if there is more than one network interface then check that
> -                               // we can join on specific interfaces and that we only receive
> -                               // if data is received on that interface
> -                               if (atLeastTwoInterfaces) {
> -                                       // set up server on first interfaces
> -                                       NetworkInterface loopbackInterface = NetworkInterface
> -                                                       .getByInetAddress(InetAddress
> -                                                                       .getByName("127.0.0.1"));
> -
> -                                       theInterfaces = NetworkInterface.getNetworkInterfaces();
> -                                       while (theInterfaces.hasMoreElements()) {
> -
> -                                               NetworkInterface thisInterface = (NetworkInterface) theInterfaces
> -                                                               .nextElement();
> -                                               if ((thisInterface.getInetAddresses() != null)
> -                                                               && (Support_NetworkInterface
> -                                                                               .useInterface(thisInterface) == true)) {
> -                                                       // get the first address on the interface
> -
> -                                                       // start server which is joined to the group and has
> -                                                       // only asked for packets on this interface
> -                                                       Enumeration addresses = thisInterface
> -                                                                       .getInetAddresses();
> -
> -                                                       NetworkInterface sendingInterface = null;
> -                                                       boolean isLoopback = false;
> -                                                       if (addresses != null) {
> -                                                               InetAddress firstAddress = (InetAddress) addresses
> -                                                                               .nextElement();
> -                                                               if (firstAddress.isLoopbackAddress()) {
> -                                                                       isLoopback = true;
> -                                                               }
> -                                                               if (firstAddress instanceof Inet4Address) {
> -                                                                       group = InetAddress.getByName("224.0.0.4");
> -                                                                       if (networkInterface1
> -                                                                                       .equals(NetworkInterface
> -                                                                                                       .getByInetAddress(InetAddress
> -                                                                                                                       .getByName("127.0.0.1")))) {
> -                                                                               sendingInterface = networkInterface2;
> -                                                                       } else {
> -                                                                               sendingInterface = networkInterface1;
> -                                                                       }
> -                                                               } else {
> -                                                                       // if this interface only seems to support
> -                                                                       // IPV6 addresses
> -                                                                       group = InetAddress
> -                                                                                       .getByName("FF01:0:0:0:0:0:2:8001");
> -                                                                       sendingInterface = IPV6networkInterface1;
> -                                                               }
> -                                                       }
> -
> -                                                       InetAddress useAddress = null;
> -                                                       addresses = sendingInterface.getInetAddresses();
> -                                                       if ((addresses != null)
> -                                                                       && (addresses.hasMoreElements())) {
> -                                                               useAddress = (InetAddress) addresses
> -                                                                               .nextElement();
> -                                                       }
> -
> -                                                       ports = Support_PortManager.getNextPortsForUDP(2);
> -                                                       serverPort = ports[0];
> -                                                       groupPort = ports[1];
> -                                                       groupSockAddr = new InetSocketAddress(group,
> -                                                                       serverPort);
> -                                                       server = new MulticastServer(groupSockAddr,
> -                                                                       serverPort, thisInterface);
> -                                                       server.start();
> -                                                       Thread.sleep(1000);
> -
> -                                                       // Now send out a package on interface
> -                                                       // networkInterface 1. We should
> -                                                       // only see the packet if we send it on interface 1
> -                                                       InetSocketAddress theAddress = new InetSocketAddress(
> -                                                                       useAddress, groupPort);
> -                                                       mss = new MulticastSocket(groupPort);
> -                                                       mss.setNetworkInterface(sendingInterface);
> -                                                       msg = "Hello World - Again"
> -                                                                       + thisInterface.getName();
> -                                                       sdp = new DatagramPacket(msg.getBytes(), msg
> -                                                                       .length(), group, serverPort);
> -                                                       mss.send(sdp);
> -                                                       Thread.sleep(1000);
> -                                                       if (thisInterface.equals(sendingInterface)) {
> -                                                               assertTrue(
> -                                                                               "Group member did not recv data when bound on specific interface: ",
> -                                                                               new String(server.rdp.getData(), 0,
> -                                                                                               server.rdp.getLength())
> -                                                                                               .equals(msg));
> -                                                       } else {
> -                                                               assertFalse(
> -                                                                               "Group member received data on other interface when only asked for it on one interface: ",
> -                                                                               new String(server.rdp.getData(), 0,
> -                                                                                               server.rdp.getLength())
> -                                                                                               .equals(msg));
> -                                                       }
> +        // now validate we get the expected error if the address specified
> +        // is not a multicast group
> +        try {
> +            groupSockAddr = new InetSocketAddress(InetAddress
> +                    .getByName("255.255.255.255"), groupPort);
> +            mss.joinGroup(groupSockAddr, null);
> +            fail("Did not get exception when group is not a multicast address");
> +        } catch (IOException e) {
> +        }
>
> -                                                       server.stopServer();
> -                                               }
> -                                       }
> +        // now try to join a group if we are not authorized
> +        // set the security manager that will make the first address not
> +        // visible
> +        System.setSecurityManager(new mySecurityManager());
> +        try {
> +            group = InetAddress.getByName("224.0.0.3");
> +            groupSockAddr = new InetSocketAddress(group, groupPort);
> +            mss.joinGroup(groupSockAddr, null);
> +            fail("Did not get exception when joining group is not allowed");
> +        } catch (SecurityException e) {
> +        }
> +        System.setSecurityManager(null);
>
> -                                       // validate that we can join the same address on two
> -                                       // different interfaces but not on the same interface
> -                                       groupPort = Support_PortManager.getNextPortForUDP();
> -                                       mss = new MulticastSocket(groupPort);
> -                                       mss.joinGroup(groupSockAddr, networkInterface1);
> -                                       mss.joinGroup(groupSockAddr, networkInterface2);
> -                                       try {
> -                                               mss.joinGroup(groupSockAddr, networkInterface1);
> -                                               fail(
> -                                                               "Did not get expected exception when joining for second time on same interface");
> -                                       } catch (IOException e) {
> -                                       }
> -                               }
> -                       }
> -               } catch (Exception e) {
> -                       fail("Exception during joinGroup test: " + e.toString());
> -               }
> +        if (atLeastOneInterface) {
> +            // now validate that we can properly join a group with a null
> +            // network interface
> +            ports = Support_PortManager.getNextPortsForUDP(2);
> +            groupPort = ports[0];
> +            serverPort = ports[1];
> +            mss = new MulticastSocket(groupPort);
> +            mss.joinGroup(groupSockAddr, null);
> +            mss.setTimeToLive(2);
> +            Thread.sleep(1000);
> +
> +            // set up the server and join the group on networkInterface1
> +            group = InetAddress.getByName("224.0.0.3");
> +            groupSockAddr = new InetSocketAddress(group, groupPort);
> +            server = new MulticastServer(groupSockAddr, serverPort,
> +                    networkInterface1);
> +            server.start();
> +            Thread.sleep(1000);
> +            msg = "Hello World";
> +            DatagramPacket sdp = new DatagramPacket(msg.getBytes(), msg
> +                    .length(), group, serverPort);
> +            mss.setTimeToLive(2);
> +            mss.send(sdp);
> +            Thread.sleep(1000);
> +            // now vaildate that we received the data as expected
> +            assertTrue("Group member did not recv data: ", new String(
> +                    server.rdp.getData(), 0, server.rdp.getLength())
> +                    .equals(msg));
> +            server.stopServer();
> +
> +            // now validate that we handled the case were we join a
> +            // different multicast address.
> +            // verify we do not receive the data
> +            ports = Support_PortManager.getNextPortsForUDP(2);
> +            serverPort = ports[0];
> +            server = new MulticastServer(groupSockAddr, serverPort,
> +                    networkInterface1);
> +            server.start();
> +            Thread.sleep(1000);
> +
> +            groupPort = ports[1];
> +            mss = new MulticastSocket(groupPort);
> +            InetAddress group2 = InetAddress.getByName("224.0.0.4");
> +            mss.setTimeToLive(10);
> +            msg = "Hello World - Different Group";
> +            sdp = new DatagramPacket(msg.getBytes(), msg.length(), group2,
> +                    serverPort);
> +            mss.send(sdp);
> +            Thread.sleep(1000);
> +            assertFalse(
> +                    "Group member received data when sent on different group: ",
> +                    new String(server.rdp.getData(), 0, server.rdp.getLength())
> +                            .equals(msg));
> +            server.stopServer();
> +
> +            // if there is more than one network interface then check that
> +            // we can join on specific interfaces and that we only receive
> +            // if data is received on that interface
> +            if (atLeastTwoInterfaces) {
> +                // set up server on first interfaces
> +                NetworkInterface loopbackInterface = NetworkInterface
> +                        .getByInetAddress(InetAddress.getByName("127.0.0.1"));
> +
> +                theInterfaces = NetworkInterface.getNetworkInterfaces();
> +                while (theInterfaces.hasMoreElements()) {
> +
> +                    NetworkInterface thisInterface = (NetworkInterface) theInterfaces
> +                            .nextElement();
> +                    if ((thisInterface.getInetAddresses() != null && thisInterface
> +                            .getInetAddresses().hasMoreElements())
> +                            && (Support_NetworkInterface
> +                                    .useInterface(thisInterface) == true)) {
> +                        // get the first address on the interface
> +
> +                        // start server which is joined to the group and has
> +                        // only asked for packets on this interface
> +                        Enumeration addresses = thisInterface
> +                                .getInetAddresses();
> +
> +                        NetworkInterface sendingInterface = null;
> +                        boolean isLoopback = false;
> +                        if (addresses != null) {
> +                            InetAddress firstAddress = (InetAddress) addresses
> +                                    .nextElement();
> +                            if (firstAddress.isLoopbackAddress()) {
> +                                isLoopback = true;
> +                            }
> +                            if (firstAddress instanceof Inet4Address) {
> +                                group = InetAddress.getByName("224.0.0.4");
> +                                if (networkInterface1.equals(NetworkInterface
> +                                        .getByInetAddress(InetAddress
> +                                                .getByName("127.0.0.1")))) {
> +                                    sendingInterface = networkInterface2;
> +                                } else {
> +                                    sendingInterface = networkInterface1;
> +                                }
> +                            } else {
> +                                // if this interface only seems to support
> +                                // IPV6 addresses
> +                                group = InetAddress
> +                                        .getByName("FF01:0:0:0:0:0:2:8001");
> +                                sendingInterface = IPV6networkInterface1;
> +                            }
> +                        }
> +
> +                        InetAddress useAddress = null;
> +                        addresses = sendingInterface.getInetAddresses();
> +                        if ((addresses != null)
> +                                && (addresses.hasMoreElements())) {
> +                            useAddress = (InetAddress) addresses.nextElement();
> +                        }
> +
> +                        ports = Support_PortManager.getNextPortsForUDP(2);
> +                        serverPort = ports[0];
> +                        groupPort = ports[1];
> +                        groupSockAddr = new InetSocketAddress(group, serverPort);
> +                        server = new MulticastServer(groupSockAddr, serverPort,
> +                                thisInterface);
> +                        server.start();
> +                        Thread.sleep(1000);
> +
> +                        // Now send out a package on interface
> +                        // networkInterface 1. We should
> +                        // only see the packet if we send it on interface 1
> +                        InetSocketAddress theAddress = new InetSocketAddress(
> +                                useAddress, groupPort);
> +                        mss = new MulticastSocket(groupPort);
> +                        mss.setNetworkInterface(sendingInterface);
> +                        msg = "Hello World - Again" + thisInterface.getName();
> +                        sdp = new DatagramPacket(msg.getBytes(), msg.length(),
> +                                group, serverPort);
> +                        mss.send(sdp);
> +                        Thread.sleep(1000);
> +                        if (thisInterface.equals(sendingInterface)) {
> +                            assertTrue(
> +                                    "Group member did not recv data when bound on specific interface: ",
> +                                    new String(server.rdp.getData(), 0,
> +                                            server.rdp.getLength()).equals(msg));
> +                        } else {
> +                            assertFalse(
> +                                    "Group member received data on other interface when only asked for it on one interface: ",
> +                                    new String(server.rdp.getData(), 0,
> +                                            server.rdp.getLength()).equals(msg));
> +                        }
> +
> +                        server.stopServer();
> +                    }
> +                }
> +
> +                // validate that we can join the same address on two
> +                // different interfaces but not on the same interface
> +                groupPort = Support_PortManager.getNextPortForUDP();
> +                mss = new MulticastSocket(groupPort);
> +                mss.joinGroup(groupSockAddr, networkInterface1);
> +                mss.joinGroup(groupSockAddr, networkInterface2);
> +                try {
> +                    mss.joinGroup(groupSockAddr, networkInterface1);
> +                    fail("Did not get expected exception when joining for second time on same interface");
> +                } catch (IOException e) {
> +                }
> +            }
> +        }
>                System.setSecurityManager(null);
>        }
>
> @@ -805,101 +789,95 @@
>        }
>
>        /**
> +        * @throws IOException
> +        * @throws InterruptedException
>         * @tests java.net.MulticastSocket#setNetworkInterface(java.net.NetworkInterface)
>         */
> -       public void test_setNetworkInterfaceLjava_net_NetworkInterface() {
> +       public void test_setNetworkInterfaceLjava_net_NetworkInterface() throws IOException, InterruptedException {
>                String msg = null;
>                InetAddress group = null;
>                int[] ports = Support_PortManager.getNextPortsForUDP(2);
>                int groupPort = ports[0];
>                int serverPort = ports[1];
> -               try {
> -                       if (atLeastOneInterface) {
> -                               // validate that null interface is handled ok
> -                               mss = new MulticastSocket(groupPort);
> -
> -                               // this should through a socket exception to be compatible
> -                               try {
> -                                       mss.setNetworkInterface(null);
> -                                       fail(
> -                                                       "No socket exception when we set then network interface with NULL");
> -                               } catch (SocketException ex) {
> -                               }
> -
> -                               // validate that we can get and set the interface
> -                               groupPort = Support_PortManager.getNextPortForUDP();
> -                               mss = new MulticastSocket(groupPort);
> -                               mss.setNetworkInterface(networkInterface1);
> -                               assertTrue(
> -                                               "Interface did not seem to be set by setNeworkInterface",
> -                                               networkInterface1.equals(mss.getNetworkInterface()));
> -
> -                               // set up the server and join the group
> -                               group = InetAddress.getByName("224.0.0.3");
> -
> -                               Enumeration theInterfaces = NetworkInterface
> -                                               .getNetworkInterfaces();
> -                               while (theInterfaces.hasMoreElements()) {
> -                                       NetworkInterface thisInterface = (NetworkInterface) theInterfaces
> -                                                       .nextElement();
> -                                       if (thisInterface.getInetAddresses() != null) {
> -                                               if ((!((InetAddress) thisInterface.getInetAddresses()
> -                                                               .nextElement()).isLoopbackAddress())
> -                                                               &&
> -                                                               // for windows we cannot use these pseudo
> -                                                               // interfaces for the test as the packets still
> -                                                               // come from the actual interface, not the
> -                                                               // Pseudo interface that was set
> -                                                               (Support_NetworkInterface
> -                                                                               .useInterface(thisInterface) == true)) {
> -                                                       ports = Support_PortManager.getNextPortsForUDP(2);
> -                                                       serverPort = ports[0];
> -                                                       server = new MulticastServer(group, serverPort);
> -                                                       server.start();
> -                                                       // give the server some time to start up
> -                                                       Thread.sleep(1000);
> -
> -                                                       // Send the packets on a particular interface. The
> -                                                       // source address in the received packet
> -                                                       // should be one of the addresses for the interface
> -                                                       // set
> -                                                       groupPort = ports[1];
> -                                                       mss = new MulticastSocket(groupPort);
> -                                                       mss.setNetworkInterface(thisInterface);
> -                                                       msg = thisInterface.getName();
> -                                                       byte theBytes[] = msg.getBytes();
> -                                                       DatagramPacket sdp = new DatagramPacket(theBytes,
> -                                                                       theBytes.length, group, serverPort);
> -                                                       mss.send(sdp);
> -                                                       Thread.sleep(1000);
> -                                                       String receivedMessage = new String(server.rdp
> -                                                                       .getData(), 0, server.rdp.getLength());
> -                                                       assertTrue(
> -                                                                       "Group member did not recv data when send on a specific interface: ",
> -                                                                       receivedMessage.equals(msg));
> -                                                       assertTrue(
> -                                                                       "Datagram was not received from expected interface expected["
> -                                                                                       + thisInterface
> -                                                                                       + "] got ["
> -                                                                                       + NetworkInterface
> -                                                                                                       .getByInetAddress(server.rdp
> -                                                                                                                       .getAddress())
> -                                                                                       + "]", NetworkInterface
> -                                                                                       .getByInetAddress(
> -                                                                                                       server.rdp.getAddress())
> -                                                                                       .equals(thisInterface));
> -
> -                                                       // stop the server
> -                                                       server.stopServer();
> -                                               }
> -                                       }
> -                               }
> -                       }
> -                       ;
> -               } catch (Exception e) {
> -                       fail("Exception during setNetworkInterface test: "
> -                                       + e.toString());
> -               }
> +               if (atLeastOneInterface) {
> +            // validate that null interface is handled ok
> +            mss = new MulticastSocket(groupPort);
> +
> +            // this should through a socket exception to be compatible
> +            try {
> +                mss.setNetworkInterface(null);
> +                fail("No socket exception when we set then network interface with NULL");
> +            } catch (SocketException ex) {
> +            }
> +
> +            // validate that we can get and set the interface
> +            groupPort = Support_PortManager.getNextPortForUDP();
> +            mss = new MulticastSocket(groupPort);
> +            mss.setNetworkInterface(networkInterface1);
> +            assertTrue(
> +                    "Interface did not seem to be set by setNeworkInterface",
> +                    networkInterface1.equals(mss.getNetworkInterface()));
> +
> +            // set up the server and join the group
> +            group = InetAddress.getByName("224.0.0.3");
> +
> +            Enumeration theInterfaces = NetworkInterface.getNetworkInterfaces();
> +            while (theInterfaces.hasMoreElements()) {
> +                NetworkInterface thisInterface = (NetworkInterface) theInterfaces
> +                        .nextElement();
> +                if (thisInterface.getInetAddresses() != null
> +                        && thisInterface.getInetAddresses().hasMoreElements()) {
> +                    if ((!((InetAddress) thisInterface.getInetAddresses()
> +                            .nextElement()).isLoopbackAddress())
> +                            &&
> +                            // for windows we cannot use these pseudo
> +                            // interfaces for the test as the packets still
> +                            // come from the actual interface, not the
> +                            // Pseudo interface that was set
> +                            (Support_NetworkInterface
> +                                    .useInterface(thisInterface) == true)) {
> +                        ports = Support_PortManager.getNextPortsForUDP(2);
> +                        serverPort = ports[0];
> +                        server = new MulticastServer(group, serverPort);
> +                        server.start();
> +                        // give the server some time to start up
> +                        Thread.sleep(1000);
> +
> +                        // Send the packets on a particular interface. The
> +                        // source address in the received packet
> +                        // should be one of the addresses for the interface
> +                        // set
> +                        groupPort = ports[1];
> +                        mss = new MulticastSocket(groupPort);
> +                        mss.setNetworkInterface(thisInterface);
> +                        msg = thisInterface.getName();
> +                        byte theBytes[] = msg.getBytes();
> +                        DatagramPacket sdp = new DatagramPacket(theBytes,
> +                                theBytes.length, group, serverPort);
> +                        mss.send(sdp);
> +                        Thread.sleep(1000);
> +                        String receivedMessage = new String(server.rdp
> +                                .getData(), 0, server.rdp.getLength());
> +                        assertTrue(
> +                                "Group member did not recv data when send on a specific interface: ",
> +                                receivedMessage.equals(msg));
> +                        assertTrue(
> +                                "Datagram was not received from expected interface expected["
> +                                        + thisInterface
> +                                        + "] got ["
> +                                        + NetworkInterface
> +                                                .getByInetAddress(server.rdp
> +                                                        .getAddress()) + "]",
> +                                NetworkInterface.getByInetAddress(
> +                                        server.rdp.getAddress()).equals(
> +                                        thisInterface));
> +
> +                        // stop the server
> +                        server.stopServer();
> +                    }
> +                }
> +            }
> +        }
>        }
>
>        /**
> @@ -1143,31 +1121,35 @@
>
>                        atLeastOneInterface = false;
>                        while (theInterfaces.hasMoreElements()
> -                                       && (atLeastOneInterface == false)) {
> -                               networkInterface1 = (NetworkInterface) theInterfaces
> -                                               .nextElement();
> -                               if ((networkInterface1.getInetAddresses() != null) &&
> -                               // we only want real interfaces
> -                                               (Support_NetworkInterface
> -                                                               .useInterface(networkInterface1) == true)) {
> -                                       atLeastOneInterface = true;
> -                               }
> -                       }
> +                    && (atLeastOneInterface == false)) {
> +                networkInterface1 = (NetworkInterface) theInterfaces
> +                        .nextElement();
> +                if ((networkInterface1.getInetAddresses() != null)
> +                        && networkInterface1.getInetAddresses()
> +                                .hasMoreElements() &&
> +                        // we only want real interfaces
> +                        (Support_NetworkInterface
> +                                .useInterface(networkInterface1) == true)) {
> +                    atLeastOneInterface = true;
> +                }
> +            }
>
>                        atLeastTwoInterfaces = false;
>                        if (theInterfaces.hasMoreElements()) {
> -                               while (theInterfaces.hasMoreElements()
> -                                               && (atLeastTwoInterfaces == false)) {
> -                                       networkInterface2 = (NetworkInterface) theInterfaces
> -                                                       .nextElement();
> -                                       if ((networkInterface2.getInetAddresses() != null) &&
> -                                       // we only want real interfaces
> -                                                       (Support_NetworkInterface
> -                                                                       .useInterface(networkInterface2) == true)) {
> -                                               atLeastTwoInterfaces = true;
> -                                       }
> -                               }
> -                       }
> +                while (theInterfaces.hasMoreElements()
> +                        && (atLeastTwoInterfaces == false)) {
> +                    networkInterface2 = (NetworkInterface) theInterfaces
> +                            .nextElement();
> +                    if ((networkInterface2.getInetAddresses() != null)
> +                            && networkInterface2.getInetAddresses()
> +                                    .hasMoreElements() &&
> +                            // we only want real interfaces
> +                            (Support_NetworkInterface
> +                                    .useInterface(networkInterface2) == true)) {
> +                        atLeastTwoInterfaces = true;
> +                    }
> +                }
> +            }
>
>                        Enumeration addresses;
>
>
>
>