commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r1099116 - /commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNetworkImpl.java
Date Tue, 03 May 2011 16:30:13 GMT
Author: mturk
Date: Tue May  3 16:30:13 2011
New Revision: 1099116

URL: http://svn.apache.org/viewvc?rev=1099116&view=rev
Log:
Add IPv6 test

Modified:
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNetworkImpl.java

Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNetworkImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNetworkImpl.java?rev=1099116&r1=1099115&r2=1099116&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNetworkImpl.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNetworkImpl.java
Tue May  3 16:30:13 2011
@@ -119,6 +119,34 @@ public class TestNetworkImpl extends Ass
     }
 
     @Test(groups = { "core" })
+    public void connectIPv6Socket()
+        throws IOException
+    {
+        ServerSocket ss = new ServerSocket(0, 1, InetAddress.getByName("::1"));
+        Worker w = new Worker(ss);
+        w.start();
+        try {
+
+            Thread.sleep(500);
+        } catch (InterruptedException x) {
+            // Ignore
+        }
+        // Create unbound socket
+        // FileDescriptor is null until bind call
+        //
+        Socket s = new Socket("::1", ss.getLocalPort());
+        // Check various FileDescriptor instances for the Socket
+        FileDescriptor fd = SocketInstance.getFileDescriptor(s);
+        assertNotNull(fd);
+        FileOutputStream fs = (FileOutputStream)s.getOutputStream();
+        FileInputStream  fi = (FileInputStream)s.getInputStream();
+        assertEquals(fd, fs.getFD());
+        assertEquals(fd, fi.getFD());
+        assertEquals(fs.getFD(), fi.getFD());
+        s.close();
+    }
+
+    @Test(groups = { "core" })
     public void boundDatagramSocket()
         throws IOException
     {



Mime
View raw message