You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by re...@apache.org on 2009/04/14 09:47:47 UTC

svn commit: r764696 - /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java

Author: regisxu
Date: Tue Apr 14 07:47:46 2009
New Revision: 764696

URL: http://svn.apache.org/viewvc?rev=764696&view=rev
Log:
Add regression test for HARMONY-6090

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java?rev=764696&r1=764695&r2=764696&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java Tue Apr 14 07:47:46 2009
@@ -33,6 +33,7 @@
 import java.net.SocketImplFactory;
 import java.net.UnknownHostException;
 import java.util.Date;
+import java.util.Locale;
 import java.util.Properties;
 
 import org.apache.harmony.luni.net.PlainServerSocketImpl;
@@ -671,6 +672,26 @@
                 .isClosed());
     }
 
+    /*
+     * Regression HARMONY-6090
+     */
+    public void test_defaultValueReuseAddress() throws Exception {
+        String platform = System.getProperty("os.name").toLowerCase(Locale.US);
+        if (!platform.startsWith("windows")) {
+            // on Unix
+            assertTrue(new ServerSocket().getReuseAddress());
+            assertTrue(new ServerSocket(0).getReuseAddress());
+            assertTrue(new ServerSocket(0, 50).getReuseAddress());
+            assertTrue(new ServerSocket(0, 50, InetAddress.getLocalHost()).getReuseAddress());
+        } else {
+            // on Windows
+            assertFalse(new ServerSocket().getReuseAddress());
+            assertFalse(new ServerSocket(0).getReuseAddress());
+            assertFalse(new ServerSocket(0, 50).getReuseAddress());
+            assertFalse(new ServerSocket(0, 50, InetAddress.getLocalHost()).getReuseAddress());
+        }
+    }
+
     /**
      * @tests java.net.ServerSocket#setReuseAddress(boolean)
      */