harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r960862 - /harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
Date Tue, 06 Jul 2010 10:26:50 GMT
Author: tellison
Date: Tue Jul  6 10:26:50 2010
New Revision: 960862

URL: http://svn.apache.org/viewvc?rev=960862&view=rev
Log:
Make the NIO socket channel tests a bit more robust by ensuring the reader drains the channel
before asserting the content.

Modified:
    harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java?rev=960862&r1=960861&r2=960862&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/SocketChannelTest.java
Tue Jul  6 10:26:50 2010
@@ -2782,15 +2782,15 @@ public class SocketChannelTest extends T
 
         // Write them out, read what we wrote and check it
         client.write(buffers);
+        client.close();
         ByteBuffer readBuffer = ByteBuffer.allocate(1024);
-        worker.read(readBuffer);
+        while (EOF != worker.read(readBuffer)) {};
         readBuffer.flip();
         Buffer expected = ByteBuffer.allocate(1024).put(data).put(data).flip();
         assertEquals(expected, readBuffer);
 
         // Tidy-up
         worker.close();
-        client.close();
         server.close();
     }
 
@@ -2824,14 +2824,14 @@ public class SocketChannelTest extends T
 
         // Write them out, read what we wrote and check it
         client.write(buffers);
+        client.close();
         ByteBuffer readBuffer = ByteBuffer.allocate(1024);
-        worker.read(readBuffer);
+        while (EOF != worker.read(readBuffer)) {};
         readBuffer.flip();
         assertEquals(ByteBuffer.wrap(data), readBuffer);
 
         // Tidy-up
         worker.close();
-        client.close();
         server.close();
     }
 
@@ -2864,16 +2864,16 @@ public class SocketChannelTest extends T
         client.write(buffers, 0, 2); // writes "world!"
         assertEquals("Failed to drain buffer 1", 0, buffers[1].remaining());
         client.write(buffers, 0, 3); // write nothing
+        client.close();
 
         // Read what we wrote and check it
         ByteBuffer readBuffer = ByteBuffer.allocate(1024);
-        worker.read(readBuffer);
+        while (EOF != worker.read(readBuffer)) {};
         readBuffer.flip();
         assertEquals(ByteBuffer.wrap(data), readBuffer);
 
         // Tidy-up
         worker.close();
-        client.close();
         server.close();
     }
 



Mime
View raw message