You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2010/04/23 21:11:57 UTC

svn commit: r937477 [7/9] - in /httpcomponents/httpcore/trunk/httpcore-nio/src: main/java/org/apache/http/impl/nio/ main/java/org/apache/http/impl/nio/codecs/ main/java/org/apache/http/impl/nio/reactor/ main/java/org/apache/http/impl/nio/ssl/ main/java...

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedDecoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedDecoder.java Fri Apr 23 19:11:53 2010
@@ -48,7 +48,7 @@ import org.apache.http.params.HttpParams
 /**
  * Simple tests for {@link LengthDelimitedDecoder}.
  *
- * 
+ *
  * @version $Id$
  */
 public class TestLengthDelimitedDecoder extends TestCase {
@@ -62,13 +62,13 @@ public class TestLengthDelimitedDecoder 
 
     private static String convert(final ByteBuffer src) {
         src.flip();
-        StringBuffer buffer = new StringBuffer(src.remaining()); 
+        StringBuffer buffer = new StringBuffer(src.remaining());
         while (src.hasRemaining()) {
             buffer.append((char)(src.get() & 0xff));
         }
         return buffer.toString();
     }
-    
+
     private static String readFromFile(final File file) throws Exception {
         FileInputStream filestream = new FileInputStream(file);
         InputStreamReader reader = new InputStreamReader(filestream);
@@ -87,63 +87,63 @@ public class TestLengthDelimitedDecoder 
 
     public void testBasicDecoding() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff;", "more stuff"}, "US-ASCII"); 
+                new String[] {"stuff;", "more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 16); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+                channel, inbuf, metrics, 16);
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(6, bytesRead);
         assertEquals("stuff;", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(6, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(10, bytesRead);
         assertEquals("more stuff", convert(dst));
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
     }
-    
+
     public void testCodingBeyondContentLimit() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
                 new String[] {
-                        "stuff;", 
-                        "more stuff; and a lot more stuff"}, "US-ASCII"); 
+                        "stuff;",
+                        "more stuff; and a lot more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 16); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+                channel, inbuf, metrics, 16);
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(6, bytesRead);
         assertEquals("stuff;", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(6, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(10, bytesRead);
         assertEquals("more stuff", convert(dst));
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
@@ -153,29 +153,29 @@ public class TestLengthDelimitedDecoder 
 
     public void testBasicDecodingSmallBuffer() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff;", "more stuff"}, "US-ASCII"); 
+                new String[] {"stuff;", "more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 16); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(4); 
-        
+                channel, inbuf, metrics, 16);
+
+        ByteBuffer dst = ByteBuffer.allocate(4);
+
         int bytesRead = decoder.read(dst);
         assertEquals(4, bytesRead);
         assertEquals("stuf", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(4, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(2, bytesRead);
         assertEquals("f;", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(6, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(4, bytesRead);
@@ -203,37 +203,37 @@ public class TestLengthDelimitedDecoder 
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
     }
-    
+
     public void testDecodingFromSessionBuffer1() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff;", "more stuff"}, "US-ASCII"); 
+                new String[] {"stuff;", "more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
+
         SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
 
         inbuf.fill(channel);
-        
+
         assertEquals(6, inbuf.length());
-        
+
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 16); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+                channel, inbuf, metrics, 16);
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(6, bytesRead);
         assertEquals("stuff;", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(0, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(10, bytesRead);
         assertEquals("more stuff", convert(dst));
         assertTrue(decoder.isCompleted());
         assertEquals(10, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
@@ -244,29 +244,29 @@ public class TestLengthDelimitedDecoder 
     public void testDecodingFromSessionBuffer2() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
                 new String[] {
-                        "stuff;", 
-                        "more stuff; and a lot more stuff"}, "US-ASCII"); 
+                        "stuff;",
+                        "more stuff; and a lot more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
+
         SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
 
         inbuf.fill(channel);
         inbuf.fill(channel);
-        
+
         assertEquals(38, inbuf.length());
-        
+
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 16); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+                channel, inbuf, metrics, 16);
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(16, bytesRead);
         assertEquals("stuff;more stuff", convert(dst));
         assertTrue(decoder.isCompleted());
         assertEquals(0, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
@@ -276,19 +276,19 @@ public class TestLengthDelimitedDecoder 
 
     public void testBasicDecodingFile() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII"); 
+                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 36); 
-        
+                channel, inbuf, metrics, 36);
+
         File fileHandle = File.createTempFile("testFile", ".txt");
 
-        RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw"); 
+        RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw");
         FileChannel fchannel = testfile.getChannel();
-            
+
         long pos = 0;
         while (!decoder.isCompleted()) {
             long bytesRead = decoder.transfer(fchannel, pos, 10);
@@ -298,12 +298,12 @@ public class TestLengthDelimitedDecoder 
         }
         assertEquals(testfile.length(), metrics.getBytesTransferred());
         fchannel.close();
-        
+
         assertEquals("stuff; more stuff; a lot more stuff!", readFromFile(fileHandle));
-        
+
         deleteWithCheck(fileHandle);
     }
-    
+
     private void deleteWithCheck(File handle){
         if (!handle.delete() && handle.exists()){
             System.err.println("Failed to delete: "+handle.getPath());
@@ -312,22 +312,22 @@ public class TestLengthDelimitedDecoder 
 
     public void testDecodingFileWithBufferedSessionData() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII"); 
+                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 36); 
-        
+                channel, inbuf, metrics, 36);
+
         int i = inbuf.fill(channel);
         assertEquals(7, i);
-        
+
         File fileHandle = File.createTempFile("testFile", ".txt");
 
-        RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw"); 
+        RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw");
         FileChannel fchannel = testfile.getChannel();
-            
+
         long pos = 0;
         while (!decoder.isCompleted()) {
             long bytesRead = decoder.transfer(fchannel, pos, 10);
@@ -335,38 +335,38 @@ public class TestLengthDelimitedDecoder 
                 pos += bytesRead;
             }
         }
-        
+
         assertEquals(testfile.length() - 7, metrics.getBytesTransferred());
         fchannel.close();
-        
+
         assertEquals("stuff; more stuff; a lot more stuff!", readFromFile(fileHandle));
-        
+
         deleteWithCheck(fileHandle);
     }
-    
+
     public void testDecodingFileWithOffsetAndBufferedSessionData() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII"); 
+                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 36); 
-        
+                channel, inbuf, metrics, 36);
+
         int i = inbuf.fill(channel);
         assertEquals(7, i);
-        
+
         File fileHandle = File.createTempFile("testFile", ".txt");
 
         RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw");
         byte[] beginning = "beginning; ".getBytes("US-ASCII");
         testfile.write(beginning);
         testfile.close();
-        
+
         testfile = new RandomAccessFile(fileHandle, "rw");
         FileChannel fchannel = testfile.getChannel();
-            
+
         long pos = beginning.length;
         while (!decoder.isCompleted()) {
             if(testfile.length() < pos)
@@ -376,82 +376,82 @@ public class TestLengthDelimitedDecoder 
                 pos += bytesRead;
             }
         }
-        
+
         // count everything except the initial 7 bytes that went to the session buffer
         assertEquals(testfile.length() - 7 - beginning.length, metrics.getBytesTransferred());
         fchannel.close();
-        
+
         assertEquals("beginning; stuff; more stuff; a lot more stuff!", readFromFile(fileHandle));
-        
+
         deleteWithCheck(fileHandle);
     }
-    
+
     public void testWriteBeyondFileSize() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"a"}, "US-ASCII"); 
+                new String[] {"a"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 1); 
-        
+                channel, inbuf, metrics, 1);
+
         File fileHandle = File.createTempFile("testFile", ".txt");
 
         RandomAccessFile testfile = new RandomAccessFile(fileHandle, "rw");
         FileChannel fchannel = testfile.getChannel();
         assertEquals(0, testfile.length());
-            
+
         try {
             decoder.transfer(fchannel, 5, 10);
             fail("expected IOException");
         } catch(IOException iox) {}
-        
+
         testfile.close();
         deleteWithCheck(fileHandle);
     }
-    
+
     public void testCodingBeyondContentLimitFile() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
                 new String[] {
-                        "stuff;", 
-                        "more stuff; and a lot more stuff"}, "US-ASCII"); 
+                        "stuff;",
+                        "more stuff; and a lot more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 16); 
-        
+                channel, inbuf, metrics, 16);
+
         File fileHandle = File.createTempFile("testFile", ".txt");
         RandomAccessFile testfile  = new RandomAccessFile(fileHandle, "rw");
         FileChannel fchannel = testfile.getChannel();
-        
+
         long bytesRead = decoder.transfer(fchannel, 0, 6);
         assertEquals(6, bytesRead);
         assertFalse(decoder.isCompleted());
         assertEquals(6, metrics.getBytesTransferred());
-        
+
         bytesRead = decoder.transfer(fchannel,0 , 10);
         assertEquals(10, bytesRead);
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
-        
+
         bytesRead = decoder.transfer(fchannel, 0, 1);
         assertEquals(-1, bytesRead);
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
-        
+
         testfile.close();
         deleteWithCheck(fileHandle);
     }
-    
+
     public void testInvalidConstructor() {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff;", "more stuff"}, "US-ASCII"); 
+                new String[] {"stuff;", "more stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         try {
             new LengthDelimitedDecoder(null, null, null, 10);
@@ -482,14 +482,14 @@ public class TestLengthDelimitedDecoder 
     public void testInvalidInput() throws Exception {
         String s = "stuff";
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {s}, "US-ASCII"); 
+                new String[] {s}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-    
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
                 channel, inbuf, metrics, 3);
-        
+
         try {
             decoder.read(null);
             fail("IllegalArgumentException should have been thrown");
@@ -497,23 +497,23 @@ public class TestLengthDelimitedDecoder 
             // expected
         }
     }
-    
+
     public void testZeroLengthDecoding() throws Exception {
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {"stuff"}, "US-ASCII"); 
+                new String[] {"stuff"}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
-                channel, inbuf, metrics, 0); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+                channel, inbuf, metrics, 0);
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
         assertTrue(decoder.isCompleted());
         assertEquals(0, metrics.getBytesTransferred());
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestLengthDelimitedEncoder.java Fri Apr 23 19:11:53 2010
@@ -49,7 +49,7 @@ import org.apache.http.util.EncodingUtil
 /**
  * Simple tests for {@link LengthDelimitedEncoder}.
  *
- * 
+ *
  * @version $Id$
  */
 public class TestLengthDelimitedEncoder extends TestCase {
@@ -64,13 +64,13 @@ public class TestLengthDelimitedEncoder 
     private static ByteBuffer wrap(final String s) {
         return ByteBuffer.wrap(EncodingUtils.getAsciiBytes(s));
     }
-    
+
     private static WritableByteChannel newChannel(final ByteArrayOutputStream baos) {
         return Channels.newChannel(baos);
     }
-    
+
     public void testBasicCoding() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -80,15 +80,15 @@ public class TestLengthDelimitedEncoder 
                 channel, outbuf, metrics, 16);
         encoder.write(wrap("stuff;"));
         encoder.write(wrap("more stuff"));
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("stuff;more stuff", s);
     }
-    
+
     public void testCodingBeyondContentLimit() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -98,15 +98,15 @@ public class TestLengthDelimitedEncoder 
                 channel, outbuf, metrics, 16);
         encoder.write(wrap("stuff;"));
         encoder.write(wrap("more stuff; and a lot more stuff"));
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("stuff;more stuff", s);
     }
-    
+
     public void testCodingEmptyBuffer() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -120,17 +120,17 @@ public class TestLengthDelimitedEncoder 
         empty.flip();
         encoder.write(empty);
         encoder.write(null);
-        
+
         encoder.write(wrap("more stuff"));
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("stuff;more stuff", s);
     }
 
     public void testCodingCompleted() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -150,7 +150,7 @@ public class TestLengthDelimitedEncoder 
 
     /* ----------------- FileChannel Part testing --------------------------- */
     public void testCodingBeyondContentLimitFromFile() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -158,39 +158,39 @@ public class TestLengthDelimitedEncoder 
 
         LengthDelimitedEncoder encoder = new LengthDelimitedEncoder(
                 channel, outbuf, metrics, 16);
-               
+
         File tmpFile = File.createTempFile("testFile", ".txt");
         FileOutputStream fout = new FileOutputStream(tmpFile);
         OutputStreamWriter wrtout = new OutputStreamWriter(fout);
-        
+
         wrtout.write("stuff;");
         wrtout.write("more stuff; and a lot more stuff");
-        
+
         wrtout.flush();
         wrtout.close();
-        
+
         FileChannel fchannel = new FileInputStream(tmpFile).getChannel();
-        
+
         encoder.transfer(fchannel, 0, 20);
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("stuff;more stuff", s);
-        
+
         fchannel.close();
-        
+
         deleteWithCheck(tmpFile);
     }
-    
+
     private void deleteWithCheck(File handle){
         if (!handle.delete() && handle.exists()){
             System.err.println("Failed to delete: "+handle.getPath());
         }
     }
-    
+
     public void testCodingEmptyFile() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -204,27 +204,27 @@ public class TestLengthDelimitedEncoder 
         File tmpFile = File.createTempFile("testFile", ".txt");
         FileOutputStream fout = new FileOutputStream(tmpFile);
         OutputStreamWriter wrtout = new OutputStreamWriter(fout);
-        
+
         wrtout.flush();
         wrtout.close();
-        
+
         FileChannel fchannel = new FileInputStream(tmpFile).getChannel();
-        
+
         encoder.transfer(fchannel, 0, 20);
-                
+
         encoder.write(wrap("more stuff"));
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("stuff;more stuff", s);
-        
+
         fchannel.close();
         deleteWithCheck(tmpFile);
     }
 
     public void testCodingCompletedFromFile() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -237,12 +237,12 @@ public class TestLengthDelimitedEncoder 
         File tmpFile = File.createTempFile("testFile", ".txt");
         FileOutputStream fout = new FileOutputStream(tmpFile);
         OutputStreamWriter wrtout = new OutputStreamWriter(fout);
-        
+
         wrtout.write("more stuff");
-        
+
         wrtout.flush();
         wrtout.close();
-        
+
         FileChannel fchannel = new FileInputStream(tmpFile).getChannel();
         try {
             encoder.transfer(fchannel, 0, 10);
@@ -254,9 +254,9 @@ public class TestLengthDelimitedEncoder 
             deleteWithCheck(tmpFile);
         }
     }
-    
+
     public void testCodingFromFileSmaller() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);
@@ -264,32 +264,32 @@ public class TestLengthDelimitedEncoder 
 
         LengthDelimitedEncoder encoder = new LengthDelimitedEncoder(
                 channel, outbuf, metrics, 16);
-               
+
         File tmpFile = File.createTempFile("testFile", ".txt");
         FileOutputStream fout = new FileOutputStream(tmpFile);
         OutputStreamWriter wrtout = new OutputStreamWriter(fout);
-        
+
         wrtout.write("stuff;");
         wrtout.write("more stuff;");
-        
+
         wrtout.flush();
         wrtout.close();
-        
+
         FileChannel fchannel = new FileInputStream(tmpFile).getChannel();
-        
+
         encoder.transfer(fchannel, 0, 20);
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("stuff;more stuff", s);
-        
+
         fchannel.close();
         deleteWithCheck(tmpFile);
     }
-    
+
     public void testInvalidConstructor() {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, params);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestBaseIOReactorSSL.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestBaseIOReactorSSL.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestBaseIOReactorSSL.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestBaseIOReactorSSL.java Fri Apr 23 19:11:53 2010
@@ -80,7 +80,7 @@ public class TestBaseIOReactorSSL extend
             .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
             .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "TEST-SERVER/1.1");
-        
+
         this.server = new TestHttpSSLServer(serverParams);
     }
 
@@ -121,7 +121,7 @@ public class TestBaseIOReactorSSL extend
             return TrustManagerFactory.getInstance("SunX509");
         }
     }
-    
+
     public void testBufferedInput() throws Exception {
         final int[] result = new int[1];
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
@@ -129,32 +129,32 @@ public class TestBaseIOReactorSSL extend
                     HttpContext context) throws HttpException, IOException {
                 result[0]++;
                 synchronized (result) {
-                    result.notify();                    
+                    result.notify();
                 }
             }
         };
-        
+
         NHttpServiceHandler serviceHandler = createHttpServiceHandler(
-                requestHandler, 
+                requestHandler,
                 null,
                 null);
 
         this.server.start(serviceHandler);
-        
+
         ClassLoader cl = getClass().getClassLoader();
         URL url = cl.getResource("test.keystore");
         KeyStore keystore  = KeyStore.getInstance("jks");
         keystore.load(url.openStream(), "nopassword".toCharArray());
         TrustManagerFactory tmfactory = createTrustManagerFactory();
         tmfactory.init(keystore);
-        TrustManager[] trustmanagers = tmfactory.getTrustManagers(); 
+        TrustManager[] trustmanagers = tmfactory.getTrustManagers();
         SSLContext sslcontext = SSLContext.getInstance("TLS");
-        sslcontext.init(null, trustmanagers, null);        
+        sslcontext.init(null, trustmanagers, null);
 
         ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
-        
+
         Socket socket = sslcontext.getSocketFactory().createSocket("localhost", serverAddress.getPort());
         BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
         //            123456789012345678901234567890
@@ -164,7 +164,7 @@ public class TestBaseIOReactorSSL extend
         writer.write("Header:                   \r\n");
         writer.write("\r\n");
         writer.flush();
-        
+
         synchronized (result) {
             result.wait(500);
         }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactors.java Fri Apr 23 19:11:53 2010
@@ -85,26 +85,26 @@ public class TestDefaultIOReactors exten
 
     public void testGracefulShutdown() throws Exception {
 
-        // Open some connection and make sure 
+        // Open some connection and make sure
         // they get cleanly closed upon shutdown
-        
+
         final int connNo = 10;
-        final CountDownLatch requestConns = new CountDownLatch(connNo); 
-        final AtomicInteger closedServerConns = new AtomicInteger(0); 
-        final AtomicInteger openServerConns = new AtomicInteger(0); 
-        final AtomicInteger closedClientConns = new AtomicInteger(0); 
-        final AtomicInteger openClientConns = new AtomicInteger(0); 
-        
+        final CountDownLatch requestConns = new CountDownLatch(connNo);
+        final AtomicInteger closedServerConns = new AtomicInteger(0);
+        final AtomicInteger openServerConns = new AtomicInteger(0);
+        final AtomicInteger closedClientConns = new AtomicInteger(0);
+        final AtomicInteger openClientConns = new AtomicInteger(0);
+
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
 
             public void handle(
-                    final HttpRequest request, 
-                    final HttpResponse response, 
+                    final HttpRequest request,
+                    final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
             }
-            
+
         };
-        
+
         HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() {
 
             public void initalizeContext(final HttpContext context, final Object attachment) {
@@ -126,13 +126,13 @@ public class TestDefaultIOReactors exten
                     return null;
                 }
             }
-            
+
             public void handleResponse(final HttpResponse response, final HttpContext context) {
-                requestConns.countDown();                    
+                requestConns.countDown();
             }
-            
+
         };
-     
+
         EventListener serverEventListener = new SimpleEventListener() {
 
             @Override
@@ -146,9 +146,9 @@ public class TestDefaultIOReactors exten
                 closedServerConns.incrementAndGet();
                 super.connectionClosed(conn);
             }
-            
+
         };
-        
+
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -180,9 +180,9 @@ public class TestDefaultIOReactors exten
                 closedClientConns.incrementAndGet();
                 super.connectionClosed(conn);
             }
-            
+
         };
-        
+
         HttpProcessor clientHttpProc = new ImmutableHttpProcessor(new HttpRequestInterceptor[] {
                 new RequestContent(),
                 new RequestTargetHost(),
@@ -198,24 +198,24 @@ public class TestDefaultIOReactors exten
 
         clientHandler.setEventListener(
                 clientEventListener);
-        
+
         this.server.start(serviceHandler);
         this.client.start(clientHandler);
-        
+
         ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
-        
+
         assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-        
+
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
             SessionRequest sessionRequest = this.client.openConnection(
-                    new InetSocketAddress("localhost", serverAddress.getPort()), 
+                    new InetSocketAddress("localhost", serverAddress.getPort()),
                     null);
             connRequests.add(sessionRequest);
         }
-        
+
         while (!connRequests.isEmpty()) {
             SessionRequest sessionRequest = connRequests.remove();
             sessionRequest.waitFor();
@@ -226,30 +226,30 @@ public class TestDefaultIOReactors exten
         }
 
         assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
-     
+
         requestConns.await();
         assertEquals(0, requestConns.getCount());
-     
+
         this.client.shutdown();
         this.server.shutdown();
-        
+
         assertEquals(openClientConns.get(), closedClientConns.get());
         assertEquals(openServerConns.get(), closedServerConns.get());
     }
-    
+
     public void testRuntimeException() throws Exception {
 
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
 
             public void handle(
-                    final HttpRequest request, 
-                    final HttpResponse response, 
+                    final HttpRequest request,
+                    final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
                 throw new OoopsieRuntimeException();
             }
-            
+
         };
-        
+
         HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() {
 
             public void initalizeContext(final HttpContext context, final Object attachment) {
@@ -268,12 +268,12 @@ public class TestDefaultIOReactors exten
                     return null;
                 }
             }
-            
+
             public void handleResponse(final HttpResponse response, final HttpContext context) {
             }
-            
+
         };
-     
+
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -307,52 +307,52 @@ public class TestDefaultIOReactors exten
 
         clientHandler.setEventListener(
                 new SimpleEventListener());
-        
+
         this.server.start(serviceHandler);
         this.client.start(clientHandler);
-        
+
         ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
-        
+
         this.client.openConnection(
-                new InetSocketAddress("localhost", serverAddress.getPort()), 
+                new InetSocketAddress("localhost", serverAddress.getPort()),
                 null);
-     
+
         this.server.join(20000);
-        
+
         Exception ex = this.server.getException();
         assertNotNull(ex);
         assertTrue(ex instanceof IOReactorException);
         assertNotNull(ex.getCause());
         assertTrue(ex.getCause() instanceof OoopsieRuntimeException);
-        
+
         List<ExceptionEvent> auditlog = this.server.getAuditLog();
         assertNotNull(auditlog);
         assertEquals(1, auditlog.size());
-        
+
         // I/O reactor shut down itself
         assertEquals(IOReactorStatus.SHUT_DOWN, this.server.getStatus());
-        
+
         this.client.shutdown();
         this.server.shutdown();
     }
 
     public void testUnhandledRuntimeException() throws Exception {
 
-        final CountDownLatch requestConns = new CountDownLatch(1); 
+        final CountDownLatch requestConns = new CountDownLatch(1);
 
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
 
             public void handle(
-                    final HttpRequest request, 
-                    final HttpResponse response, 
+                    final HttpRequest request,
+                    final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
                 throw new OoopsieRuntimeException();
             }
-            
+
         };
-        
+
         HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() {
 
             public void initalizeContext(final HttpContext context, final Object attachment) {
@@ -371,12 +371,12 @@ public class TestDefaultIOReactors exten
                     return null;
                 }
             }
-            
+
             public void handleResponse(final HttpResponse response, final HttpContext context) {
             }
-            
+
         };
-     
+
         IOReactorExceptionHandler exceptionHandler = new IOReactorExceptionHandler() {
 
             public boolean handle(final IOException ex) {
@@ -384,12 +384,12 @@ public class TestDefaultIOReactors exten
             }
 
             public boolean handle(final RuntimeException ex) {
-                requestConns.countDown();                    
+                requestConns.countDown();
                 return false;
             }
-          
+
         };
-        
+
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -424,20 +424,20 @@ public class TestDefaultIOReactors exten
         this.server.setExceptionHandler(exceptionHandler);
         this.server.start(serviceHandler);
         this.client.start(clientHandler);
-        
+
         ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
-        
+
         this.client.openConnection(
-                new InetSocketAddress("localhost", serverAddress.getPort()), 
+                new InetSocketAddress("localhost", serverAddress.getPort()),
                 null);
-     
+
         requestConns.await();
         assertEquals(0, requestConns.getCount());
-        
+
         this.server.join(20000);
-        
+
         Exception ex = this.server.getException();
         assertNotNull(ex);
         assertTrue(ex instanceof IOReactorException);
@@ -447,29 +447,29 @@ public class TestDefaultIOReactors exten
         List<ExceptionEvent> auditlog = this.server.getAuditLog();
         assertNotNull(auditlog);
         assertEquals(1, auditlog.size());
-        
+
         // I/O reactor shut down itself
         assertEquals(IOReactorStatus.SHUT_DOWN, this.server.getStatus());
-        
+
         this.client.shutdown();
         this.server.shutdown();
     }
 
     public void testHandledRuntimeException() throws Exception {
 
-        final CountDownLatch requestConns = new CountDownLatch(1); 
-        
+        final CountDownLatch requestConns = new CountDownLatch(1);
+
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
 
             public void handle(
-                    final HttpRequest request, 
-                    final HttpResponse response, 
+                    final HttpRequest request,
+                    final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
                 throw new OoopsieRuntimeException();
             }
-            
+
         };
-        
+
         HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() {
 
             public void initalizeContext(final HttpContext context, final Object attachment) {
@@ -488,12 +488,12 @@ public class TestDefaultIOReactors exten
                     return null;
                 }
             }
-            
+
             public void handleResponse(final HttpResponse response, final HttpContext context) {
             }
-            
+
         };
-     
+
         IOReactorExceptionHandler exceptionHandler = new IOReactorExceptionHandler() {
 
             public boolean handle(final IOException ex) {
@@ -501,12 +501,12 @@ public class TestDefaultIOReactors exten
             }
 
             public boolean handle(final RuntimeException ex) {
-                requestConns.countDown();                    
+                requestConns.countDown();
                 return true;
             }
-          
+
         };
-        
+
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -539,26 +539,26 @@ public class TestDefaultIOReactors exten
                 this.client.getParams());
 
         this.server.setExceptionHandler(exceptionHandler);
-        
+
         this.server.start(serviceHandler);
         this.client.start(clientHandler);
-        
+
         ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
-        
+
         this.client.openConnection(
-                new InetSocketAddress("localhost", serverAddress.getPort()), 
+                new InetSocketAddress("localhost", serverAddress.getPort()),
                 null);
-     
+
         requestConns.await();
         assertEquals(0, requestConns.getCount());
-        
+
         this.server.join(1000);
-        
+
         assertEquals(IOReactorStatus.ACTIVE, this.server.getStatus());
         assertNull(this.server.getException());
-        
+
         this.client.shutdown();
         this.server.shutdown();
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactorsSSL.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactorsSSL.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactorsSSL.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultIOReactorsSSL.java Fri Apr 23 19:11:53 2010
@@ -82,26 +82,26 @@ public class TestDefaultIOReactorsSSL ex
 
     public void testGracefulShutdown() throws Exception {
 
-        // Open some connection and make sure 
+        // Open some connection and make sure
         // they get cleanly closed upon shutdown
-        
+
         final int connNo = 10;
-        final CountDownLatch requestConns = new CountDownLatch(connNo); 
-        final AtomicInteger closedServerConns = new AtomicInteger(0); 
-        final AtomicInteger openServerConns = new AtomicInteger(0); 
-        final AtomicInteger closedClientConns = new AtomicInteger(0); 
-        final AtomicInteger openClientConns = new AtomicInteger(0); 
-        
+        final CountDownLatch requestConns = new CountDownLatch(connNo);
+        final AtomicInteger closedServerConns = new AtomicInteger(0);
+        final AtomicInteger openServerConns = new AtomicInteger(0);
+        final AtomicInteger closedClientConns = new AtomicInteger(0);
+        final AtomicInteger openClientConns = new AtomicInteger(0);
+
         HttpRequestHandler requestHandler = new HttpRequestHandler() {
 
             public void handle(
-                    final HttpRequest request, 
-                    final HttpResponse response, 
+                    final HttpRequest request,
+                    final HttpResponse response,
                     final HttpContext context) throws HttpException, IOException {
             }
-            
+
         };
-        
+
         HttpRequestExecutionHandler requestExecutionHandler = new HttpRequestExecutionHandler() {
 
             public void initalizeContext(final HttpContext context, final Object attachment) {
@@ -123,13 +123,13 @@ public class TestDefaultIOReactorsSSL ex
                     return null;
                 }
             }
-            
+
             public void handleResponse(final HttpResponse response, final HttpContext context) {
-                requestConns.countDown();                    
+                requestConns.countDown();
             }
-            
+
         };
-     
+
         EventListener serverEventListener = new SimpleEventListener() {
 
             @Override
@@ -143,9 +143,9 @@ public class TestDefaultIOReactorsSSL ex
                 closedServerConns.incrementAndGet();
                 super.connectionClosed(conn);
             }
-            
+
         };
-        
+
         HttpProcessor serverHttpProc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -177,9 +177,9 @@ public class TestDefaultIOReactorsSSL ex
                 closedClientConns.incrementAndGet();
                 super.connectionClosed(conn);
             }
-            
+
         };
-        
+
         HttpProcessor clientHttpProc = new ImmutableHttpProcessor(new HttpRequestInterceptor[] {
                 new RequestContent(),
                 new RequestTargetHost(),
@@ -195,24 +195,24 @@ public class TestDefaultIOReactorsSSL ex
 
         clientHandler.setEventListener(
                 clientEventListener);
-        
+
         this.server.start(serviceHandler);
         this.client.start(clientHandler);
-        
+
         ListenerEndpoint endpoint = this.server.getListenerEndpoint();
         endpoint.waitFor();
         InetSocketAddress serverAddress = (InetSocketAddress) endpoint.getAddress();
-        
+
         assertEquals("Test server status", IOReactorStatus.ACTIVE, this.server.getStatus());
-        
+
         Queue<SessionRequest> connRequests = new LinkedList<SessionRequest>();
         for (int i = 0; i < connNo; i++) {
             SessionRequest sessionRequest = this.client.openConnection(
-                    new InetSocketAddress("localhost", serverAddress.getPort()), 
+                    new InetSocketAddress("localhost", serverAddress.getPort()),
                     null);
             connRequests.add(sessionRequest);
         }
-        
+
         while (!connRequests.isEmpty()) {
             SessionRequest sessionRequest = connRequests.remove();
             sessionRequest.waitFor();
@@ -223,13 +223,13 @@ public class TestDefaultIOReactorsSSL ex
         }
 
         assertEquals("Test client status", IOReactorStatus.ACTIVE, this.client.getStatus());
-        
+
         requestConns.await();
         assertEquals(0, requestConns.getCount());
-     
+
         this.client.shutdown();
         this.server.shutdown();
-        
+
         assertEquals(openClientConns.get(), closedClientConns.get());
         assertEquals(openServerConns.get(), closedServerConns.get());
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestDefaultListeningIOReactor.java Fri Apr 23 19:11:53 2010
@@ -68,9 +68,9 @@ public class TestDefaultListeningIOReact
     // ------------------------------------------------------- TestCase Methods
 
     public void testEndpointUpAndDown() throws Exception {
-        
+
         HttpParams params = new SyncBasicHttpParams();
-        
+
         HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -83,30 +83,30 @@ public class TestDefaultListeningIOReact
                 new DefaultHttpResponseFactory(),
                 new DefaultConnectionReuseStrategy(),
                 params);
-        
+
         final IOEventDispatch eventDispatch = new DefaultServerIOEventDispatch(
-                serviceHandler, 
+                serviceHandler,
                 params);
-        
+
         final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(1, params);
-        
+
         Thread t = new Thread(new Runnable() {
-            
+
             public void run() {
                 try {
                     ioreactor.execute(eventDispatch);
                 } catch (IOException ex) {
                 }
             }
-            
+
         });
-        
+
         t.start();
-        
+
         Set<ListenerEndpoint> endpoints = ioreactor.getEndpoints();
         assertNotNull(endpoints);
         assertEquals(0, endpoints.size());
-        
+
         ListenerEndpoint port9998 = ioreactor.listen(new InetSocketAddress(9998));
         port9998.waitFor();
 
@@ -116,27 +116,27 @@ public class TestDefaultListeningIOReact
         endpoints = ioreactor.getEndpoints();
         assertNotNull(endpoints);
         assertEquals(2, endpoints.size());
-        
+
         port9998.close();
 
         endpoints = ioreactor.getEndpoints();
         assertNotNull(endpoints);
         assertEquals(1, endpoints.size());
-        
+
         ListenerEndpoint endpoint = endpoints.iterator().next();
-        
+
         assertEquals(9999, ((InetSocketAddress) endpoint.getAddress()).getPort());
-        
+
         ioreactor.shutdown(1000);
         t.join(1000);
-        
+
         assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());
     }
 
     public void testEndpointAlreadyBoundFatal() throws Exception {
-        
+
         HttpParams params = new SyncBasicHttpParams();
-        
+
         HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -149,17 +149,17 @@ public class TestDefaultListeningIOReact
                 new DefaultHttpResponseFactory(),
                 new DefaultConnectionReuseStrategy(),
                 params);
-        
+
         final IOEventDispatch eventDispatch = new DefaultServerIOEventDispatch(
-                serviceHandler, 
+                serviceHandler,
                 params);
-        
+
         final ListeningIOReactor ioreactor = new DefaultListeningIOReactor(1, params);
-        
+
         final CountDownLatch latch = new CountDownLatch(1);
-        
+
         Thread t = new Thread(new Runnable() {
-            
+
             public void run() {
                 try {
                     ioreactor.execute(eventDispatch);
@@ -168,11 +168,11 @@ public class TestDefaultListeningIOReact
                     latch.countDown();
                 }
             }
-            
+
         });
-        
+
         t.start();
-        
+
         ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(9999));
         endpoint1.waitFor();
 
@@ -183,21 +183,21 @@ public class TestDefaultListeningIOReact
         // I/O reactor is now expected to be shutting down
         latch.await(2000, TimeUnit.MILLISECONDS);
         assertTrue(ioreactor.getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0);
-        
+
         Set<ListenerEndpoint> endpoints = ioreactor.getEndpoints();
         assertNotNull(endpoints);
         assertEquals(0, endpoints.size());
-        
+
         ioreactor.shutdown(1000);
         t.join(1000);
-        
+
         assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());
     }
-    
+
     public void testEndpointAlreadyBoundNonFatal() throws Exception {
-        
+
         HttpParams params = new SyncBasicHttpParams();
-        
+
         HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
                 new ResponseDate(),
                 new ResponseServer(),
@@ -210,13 +210,13 @@ public class TestDefaultListeningIOReact
                 new DefaultHttpResponseFactory(),
                 new DefaultConnectionReuseStrategy(),
                 params);
-        
+
         final IOEventDispatch eventDispatch = new DefaultServerIOEventDispatch(
-                serviceHandler, 
+                serviceHandler,
                 params);
-        
+
         final DefaultListeningIOReactor ioreactor = new DefaultListeningIOReactor(1, params);
-        
+
         ioreactor.setExceptionHandler(new IOReactorExceptionHandler() {
 
             public boolean handle(final IOException ex) {
@@ -226,22 +226,22 @@ public class TestDefaultListeningIOReact
             public boolean handle(final RuntimeException ex) {
                 return false;
             }
-            
+
         });
-        
+
         Thread t = new Thread(new Runnable() {
-            
+
             public void run() {
                 try {
                     ioreactor.execute(eventDispatch);
                 } catch (IOException ex) {
                 }
             }
-            
+
         });
-        
+
         t.start();
-        
+
         ListenerEndpoint endpoint1 = ioreactor.listen(new InetSocketAddress(9999));
         endpoint1.waitFor();
 
@@ -251,12 +251,12 @@ public class TestDefaultListeningIOReact
 
         // Sleep a little to make sure the I/O reactor is not shutting down
         Thread.sleep(500);
-        
+
         assertEquals(IOReactorStatus.ACTIVE, ioreactor.getStatus());
-        
+
         ioreactor.shutdown(1000);
         t.join(1000);
-        
+
         assertEquals(IOReactorStatus.SHUT_DOWN, ioreactor.getStatus());
     }
 

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/reactor/TestSessionInOutBuffers.java Fri Apr 23 19:11:53 2010
@@ -48,7 +48,7 @@ import org.apache.http.util.CharArrayBuf
 /**
  * Simple tests for {@link SessionInputBuffer} and {@link SessionOutputBuffer}.
  *
- * 
+ *
  * @version $Id$
  */
 public class TestSessionInOutBuffers extends TestCase {
@@ -63,36 +63,36 @@ public class TestSessionInOutBuffers ext
     private static WritableByteChannel newChannel(final ByteArrayOutputStream outstream) {
         return Channels.newChannel(outstream);
     }
-    
-    private static ReadableByteChannel newChannel(final byte[] bytes) { 
+
+    private static ReadableByteChannel newChannel(final byte[] bytes) {
         return Channels.newChannel(new ByteArrayInputStream(bytes));
     }
 
-    private static ReadableByteChannel newChannel(final String s, final String charset) 
+    private static ReadableByteChannel newChannel(final String s, final String charset)
             throws UnsupportedEncodingException {
         return Channels.newChannel(new ByteArrayInputStream(s.getBytes(charset)));
     }
 
-    private static ReadableByteChannel newChannel(final String s) 
+    private static ReadableByteChannel newChannel(final String s)
             throws UnsupportedEncodingException {
         return newChannel(s, "US-ASCII");
     }
 
     public void testReadLineChunks() throws Exception {
-        
+
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, params);
-        
+
         ReadableByteChannel channel = newChannel("One\r\nTwo\r\nThree");
-        
+
         inbuf.fill(channel);
-        
+
         CharArrayBuffer line = new CharArrayBuffer(64);
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, false));
         assertEquals("One", line.toString());
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, false));
         assertEquals("Two", line.toString());
@@ -102,13 +102,13 @@ public class TestSessionInOutBuffers ext
 
         channel = newChannel("\r\nFour");
         inbuf.fill(channel);
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, false));
         assertEquals("Three", line.toString());
 
         inbuf.fill(channel);
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, true));
         assertEquals("Four", line.toString());
@@ -116,31 +116,31 @@ public class TestSessionInOutBuffers ext
         line.clear();
         assertFalse(inbuf.readLine(line, true));
     }
-    
+
     public void testWriteLineChunks() throws Exception {
-        
+
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(16, 16, params);
         SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, params);
-        
+
         ReadableByteChannel inChannel = newChannel("One\r\nTwo\r\nThree");
-        
+
         inbuf.fill(inChannel);
-        
+
         CharArrayBuffer line = new CharArrayBuffer(64);
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, false));
         assertEquals("One", line.toString());
-        
+
         outbuf.writeLine(line);
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, false));
         assertEquals("Two", line.toString());
 
         outbuf.writeLine(line);
-        
+
         line.clear();
         assertFalse(inbuf.readLine(line, false));
 
@@ -152,28 +152,28 @@ public class TestSessionInOutBuffers ext
         assertEquals("Three", line.toString());
 
         outbuf.writeLine(line);
-        
+
         inbuf.fill(inChannel);
-        
+
         line.clear();
         assertTrue(inbuf.readLine(line, true));
         assertEquals("Four", line.toString());
 
         outbuf.writeLine(line);
-        
+
         line.clear();
         assertFalse(inbuf.readLine(line, true));
 
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel outChannel = newChannel(outstream);
         outbuf.flush(outChannel);
-        
+
         String s = new String(outstream.toByteArray(), "US-ASCII");
         assertEquals("One\r\nTwo\r\nThree\r\nFour\r\n", s);
     }
-    
+
     public void testBasicReadWriteLine() throws Exception {
-        
+
         String[] teststrs = new String[5];
         teststrs[0] = "Hello";
         teststrs[1] = "This string should be much longer than the size of the line buffer " +
@@ -186,26 +186,26 @@ public class TestSessionInOutBuffers ext
         teststrs[2] = buffer.toString();
         teststrs[3] = "";
         teststrs[4] = "And goodbye";
-        
+
         HttpParams params = new BasicHttpParams();
-        
-        SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params); 
+
+        SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params);
         for (int i = 0; i < teststrs.length; i++) {
             outbuf.writeLine(teststrs[i]);
         }
         //this write operation should have no effect
         outbuf.writeLine((String)null);
         outbuf.writeLine((CharArrayBuffer)null);
-        
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel outChannel = newChannel(outstream);
         outbuf.flush(outChannel);
 
         ReadableByteChannel channel = newChannel(outstream.toByteArray());
-        
+
         SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, params);
         inbuf.fill(channel);
-        
+
         for (int i = 0; i < teststrs.length; i++) {
             assertEquals(teststrs[i], inbuf.readLine(true));
         }
@@ -215,13 +215,13 @@ public class TestSessionInOutBuffers ext
 
     public void testComplexReadWriteLine() throws Exception {
         HttpParams params = new BasicHttpParams();
-        
-        SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params); 
+
+        SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params);
         outbuf.write(ByteBuffer.wrap(new byte[] {'a', '\n'}));
         outbuf.write(ByteBuffer.wrap(new byte[] {'\r', '\n'}));
         outbuf.write(ByteBuffer.wrap(new byte[] {'\r', '\r', '\n'}));
         outbuf.write(ByteBuffer.wrap(new byte[] {'\n'}));
-        
+
         StringBuffer buffer = new StringBuffer();
         for (int i = 0; i < 14; i++) {
             buffer.append("a");
@@ -247,8 +247,8 @@ public class TestSessionInOutBuffers ext
         outbuf.write(ByteBuffer.wrap(buffer.toString().getBytes("US-ASCII")));
 
         outbuf.write(ByteBuffer.wrap(new byte[] {'a'}));
-        
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel outChannel = newChannel(outstream);
         outbuf.flush(outChannel);
 
@@ -256,7 +256,7 @@ public class TestSessionInOutBuffers ext
 
         SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, params);
         inbuf.fill(channel);
-        
+
         assertEquals("a", inbuf.readLine(true));
         assertEquals("", inbuf.readLine(true));
         assertEquals("\r", inbuf.readLine(true));
@@ -268,14 +268,14 @@ public class TestSessionInOutBuffers ext
         assertNull(inbuf.readLine(true));
         assertNull(inbuf.readLine(true));
     }
-    
+
     public void testReadOneByte() throws Exception {
         // make the buffer larger than that of transmitter
         byte[] out = new byte[40];
         for (int i = 0; i < out.length; i++) {
             out[i] = (byte)('0' + i);
         }
-        ReadableByteChannel channel = newChannel(out);        
+        ReadableByteChannel channel = newChannel(out);
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, params);
         while (inbuf.fill(channel) > 0) {
@@ -289,10 +289,10 @@ public class TestSessionInOutBuffers ext
             assertEquals(out[i], in[i]);
         }
     }
-    
+
     public void testReadByteBuffer() throws Exception {
         byte[] pattern = "0123456789ABCDEF".getBytes("US-ASCII");
-        ReadableByteChannel channel = newChannel(pattern);        
+        ReadableByteChannel channel = newChannel(pattern);
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, params);
         while (inbuf.fill(channel) > 0) {
@@ -306,10 +306,10 @@ public class TestSessionInOutBuffers ext
         dst.flip();
         assertEquals(dst, ByteBuffer.wrap(pattern, 10, 6));
     }
-    
+
     public void testReadByteBufferWithMaxLen() throws Exception {
         byte[] pattern = "0123456789ABCDEF".getBytes("US-ASCII");
-        ReadableByteChannel channel = newChannel(pattern);        
+        ReadableByteChannel channel = newChannel(pattern);
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, params);
         while (inbuf.fill(channel) > 0) {
@@ -329,51 +329,51 @@ public class TestSessionInOutBuffers ext
 
     public void testReadToChannel() throws Exception {
         byte[] pattern = "0123456789ABCDEF".getBytes("US-ASCII");
-        ReadableByteChannel channel = newChannel(pattern);        
+        ReadableByteChannel channel = newChannel(pattern);
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, params);
         while (inbuf.fill(channel) > 0) {
         }
-        
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel dst = newChannel(outstream);
-        
+
         assertEquals(16, inbuf.read(dst));
         assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
     }
-    
+
     public void testReadToChannelWithMaxLen() throws Exception {
         byte[] pattern = "0123456789ABCDEF".getBytes("US-ASCII");
-        ReadableByteChannel channel = newChannel(pattern);        
+        ReadableByteChannel channel = newChannel(pattern);
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, params);
         while (inbuf.fill(channel) > 0) {
         }
-        
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel dst = newChannel(outstream);
-        
+
         assertEquals(10, inbuf.read(dst, 10));
         assertEquals(3, inbuf.read(dst, 3));
         assertEquals(3, inbuf.read(dst, 10));
         assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
     }
-    
+
     public void testWriteByteBuffer() throws Exception {
         byte[] pattern = "0123456789ABCDEF0123456789ABCDEF".getBytes("US-ASCII");
 
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(4096, 1024, params);
-        ReadableByteChannel src = newChannel(pattern);        
+        ReadableByteChannel src = newChannel(pattern);
         outbuf.write(src);
-        
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(outstream);
         while (outbuf.flush(channel) > 0) {
         }
         assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
     }
-    
+
     public void testWriteFromChannel() throws Exception {
         byte[] pattern = "0123456789ABCDEF0123456789ABCDEF".getBytes("US-ASCII");
 
@@ -383,27 +383,27 @@ public class TestSessionInOutBuffers ext
         outbuf.write(ByteBuffer.wrap(pattern, 16, 10));
         outbuf.write(ByteBuffer.wrap(pattern, 26, 6));
 
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(outstream);
         while (outbuf.flush(channel) > 0) {
         }
         assertEquals(ByteBuffer.wrap(pattern), ByteBuffer.wrap(outstream.toByteArray()));
     }
-    
+
     static final int SWISS_GERMAN_HELLO [] = {
         0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4
     };
-        
+
     static final int RUSSIAN_HELLO [] = {
-        0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438, 
-        0x432, 0x435, 0x442 
-    }; 
-    
+        0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,
+        0x432, 0x435, 0x442
+    };
+
     private static String constructString(int [] unicodeChars) {
         StringBuffer buffer = new StringBuffer();
         if (unicodeChars != null) {
             for (int i = 0; i < unicodeChars.length; i++) {
-                buffer.append((char)unicodeChars[i]); 
+                buffer.append((char)unicodeChars[i]);
             }
         }
         return buffer.toString();
@@ -413,30 +413,30 @@ public class TestSessionInOutBuffers ext
         String s1 = constructString(SWISS_GERMAN_HELLO);
         String s2 = constructString(RUSSIAN_HELLO);
         String s3 = "Like hello and stuff";
-        
+
         HttpParams params = new BasicHttpParams();
         HttpProtocolParams.setHttpElementCharset(params, "UTF-8");
-        
+
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params);
-        
+
         for (int i = 0; i < 10; i++) {
             outbuf.writeLine(s1);
             outbuf.writeLine(s2);
             outbuf.writeLine(s3);
         }
-        
-        ByteArrayOutputStream outstream = new ByteArrayOutputStream(); 
+
+        ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         WritableByteChannel outChannel = newChannel(outstream);
         outbuf.flush(outChannel);
 
         byte[] tmp = outstream.toByteArray();
-        
-        ReadableByteChannel channel = newChannel(tmp);        
+
+        ReadableByteChannel channel = newChannel(tmp);
         SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, params);
-        
+
         while (inbuf.fill(channel) > 0) {
         }
-        
+
         for (int i = 0; i < 10; i++) {
             assertEquals(s1, inbuf.readLine(true));
             assertEquals(s2, inbuf.readLine(true));
@@ -446,32 +446,32 @@ public class TestSessionInOutBuffers ext
 
     public void testMalformedCharacters() throws Exception {
         HttpParams params = new BasicHttpParams();
-        String s1 = constructString(SWISS_GERMAN_HELLO);       
+        String s1 = constructString(SWISS_GERMAN_HELLO);
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params);
         try {
             outbuf.writeLine(s1);
             fail("Expected CharacterCodingException");
         } catch (CharacterCodingException expected) {
         }
-        
-        byte[] tmp = s1.getBytes("ISO-8859-1");        
-        ReadableByteChannel channel = newChannel(tmp);        
+
+        byte[] tmp = s1.getBytes("ISO-8859-1");
+        ReadableByteChannel channel = newChannel(tmp);
         SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, params);
         while (inbuf.fill(channel) > 0) {
         }
-        
+
         try {
             String s = inbuf.readLine(true);
             fail("Expected CharacterCodingException, got '" + s + "'");
         } catch (CharacterCodingException expected) {
-        }            
+        }
     }
 
     public void testInputMatchesBufferLength() throws Exception {
         HttpParams params = new BasicHttpParams();
-        String s1 = "abcde";        
+        String s1 = "abcde";
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 5, params);
         outbuf.writeLine(s1);
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupDecoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupDecoder.java Fri Apr 23 19:11:53 2010
@@ -34,10 +34,10 @@ import java.nio.channels.ReadableByteCha
 import org.apache.http.nio.ContentDecoder;
 
 public class MockupDecoder implements ContentDecoder {
-    
+
     private final ReadableByteChannel channel;
     private boolean completed;
-    
+
     public MockupDecoder(final ReadableByteChannel channel) {
         super();
         this.channel = channel;
@@ -60,5 +60,5 @@ public class MockupDecoder implements Co
     public boolean isCompleted() {
         return this.completed;
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupEncoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/MockupEncoder.java Fri Apr 23 19:11:53 2010
@@ -36,12 +36,12 @@ import org.apache.http.impl.nio.codecs.A
 import org.apache.http.nio.reactor.SessionOutputBuffer;
 
 public class MockupEncoder extends AbstractContentEncoder {
-    
+
     // TODO? remove this field and the complete() and isCompleted() methods
     private boolean completed;
-    
+
     public MockupEncoder(
-            final WritableByteChannel channel, 
+            final WritableByteChannel channel,
             final SessionOutputBuffer buffer,
             final HttpTransportMetricsImpl metrics) {
         super(channel, buffer, metrics);
@@ -51,12 +51,12 @@ public class MockupEncoder extends Abstr
     public boolean isCompleted() {
         return this.completed;
     }
-    
+
     @Override
     public void complete() throws IOException {
         this.completed = true;
     }
-    
+
     public int write(final ByteBuffer src) throws IOException {
         if (src == null) {
             return 0;
@@ -66,5 +66,5 @@ public class MockupEncoder extends Abstr
         }
         return this.channel.write(src);
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/ReadableByteChannelMockup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/ReadableByteChannelMockup.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/ReadableByteChannelMockup.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/ReadableByteChannelMockup.java Fri Apr 23 19:11:53 2010
@@ -37,12 +37,12 @@ public class ReadableByteChannelMockup i
 
     private final String[] chunks;
     private final String charset;
-    
+
     private int chunkCount = 0;
-    
+
     private ByteBuffer currentChunk;
     private boolean closed = false;
-    
+
     public ReadableByteChannelMockup(final String[] chunks, final String charset) {
         super();
         this.chunks = chunks;
@@ -60,7 +60,7 @@ public class ReadableByteChannelMockup i
             }
         }
     }
-    
+
     public int read(final ByteBuffer dst) throws IOException {
         prepareChunk();
         if (this.closed) {
@@ -81,6 +81,6 @@ public class ReadableByteChannelMockup i
     public boolean isOpen() {
         return !this.closed;
     }
-    
-    
+
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleEventListener.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleEventListener.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleEventListener.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleEventListener.java Fri Apr 23 19:11:53 2010
@@ -38,7 +38,7 @@ public class SimpleEventListener impleme
     public SimpleEventListener() {
         super();
     }
-    
+
     public void connectionOpen(final NHttpConnection conn) {
     }
 
@@ -56,5 +56,5 @@ public class SimpleEventListener impleme
     public void fatalProtocolException(final HttpException ex, final NHttpConnection conn) {
         ex.printStackTrace(System.out);
     }
-        
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleHttpRequestHandlerResolver.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleHttpRequestHandlerResolver.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleHttpRequestHandlerResolver.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/SimpleHttpRequestHandlerResolver.java Fri Apr 23 19:11:53 2010
@@ -32,12 +32,12 @@ import org.apache.http.protocol.HttpRequ
 public class SimpleHttpRequestHandlerResolver implements HttpRequestHandlerResolver {
 
     private final HttpRequestHandler handler;
-    
+
     public SimpleHttpRequestHandlerResolver(final HttpRequestHandler handler) {
         super();
         this.handler = handler;
     }
-    
+
     public HttpRequestHandler lookup(final String requestURI) {
         return this.handler;
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/TestHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/TestHttpClient.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/TestHttpClient.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/mockup/TestHttpClient.java Fri Apr 23 19:11:53 2010
@@ -45,7 +45,7 @@ public class TestHttpClient {
 
     private final DefaultConnectingIOReactor ioReactor;
     private final HttpParams params;
-    
+
     private volatile IOReactorThread thread;
 
     public TestHttpClient(final HttpParams params) throws IOException {
@@ -57,7 +57,7 @@ public class TestHttpClient {
     public HttpParams getParams() {
         return this.params;
     }
-    
+
     public void setExceptionHandler(final IOReactorExceptionHandler exceptionHandler) {
         this.ioReactor.setExceptionHandler(exceptionHandler);
     }
@@ -66,19 +66,19 @@ public class TestHttpClient {
             final NHttpClientHandler clientHandler, final HttpParams params) {
         return new DefaultClientIOEventDispatch(clientHandler, params);
     }
-    
+
     private void execute(final NHttpClientHandler clientHandler) throws IOException {
         IOEventDispatch ioEventDispatch = createIOEventDispatch(
-                clientHandler, 
-                this.params);        
-        
+                clientHandler,
+                this.params);
+
         this.ioReactor.execute(ioEventDispatch);
     }
-    
+
     public SessionRequest openConnection(final InetSocketAddress address, final Object attachment) {
         return this.ioReactor.connect(address, null, attachment, null);
     }
- 
+
     public void start(final NHttpClientHandler clientHandler) {
         this.thread = new IOReactorThread(clientHandler);
         this.thread.start();
@@ -87,17 +87,17 @@ public class TestHttpClient {
     public IOReactorStatus getStatus() {
         return this.ioReactor.getStatus();
     }
-    
+
     public List<ExceptionEvent> getAuditLog() {
         return this.ioReactor.getAuditLog();
     }
-    
+
     public void join(long timeout) throws InterruptedException {
         if (this.thread != null) {
             this.thread.join(timeout);
         }
     }
-    
+
     public Exception getException() {
         if (this.thread != null) {
             return this.thread.getException();
@@ -105,7 +105,7 @@ public class TestHttpClient {
             return null;
         }
     }
-    
+
     public void shutdown() throws IOException {
         this.ioReactor.shutdown();
         try {
@@ -113,18 +113,18 @@ public class TestHttpClient {
         } catch (InterruptedException ignore) {
         }
     }
-    
+
     private class IOReactorThread extends Thread {
 
         private final NHttpClientHandler clientHandler;
 
         private volatile Exception ex;
-        
+
         public IOReactorThread(final NHttpClientHandler clientHandler) {
             super();
             this.clientHandler = clientHandler;
         }
-        
+
         @Override
         public void run() {
             try {
@@ -133,11 +133,11 @@ public class TestHttpClient {
                 this.ex = ex;
             }
         }
-        
+
         public Exception getException() {
             return this.ex;
         }
 
-    }    
-    
+    }
+
 }