hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r937477 [6/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...
Date Fri, 23 Apr 2010 19:11:57 GMT
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequest.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequest.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequest.java Fri Apr 23 19:11:53 2010
@@ -32,8 +32,8 @@ import java.net.SocketAddress;
 
 /**
  * SessionRequest interface represents a request to establish a new connection
- * (or session) to a remote host. It can be used to monitor the status of the 
- * request, to block waiting for its completion, or to cancel the request. 
+ * (or session) to a remote host. It can be used to monitor the status of the
+ * request, to block waiting for its completion, or to cancel the request.
  * <p>
  * Implementations of this interface are expected to be threading safe.
  *
@@ -43,81 +43,81 @@ public interface SessionRequest {
 
     /**
      * Returns socket address of the remote host.
-     * 
+     *
      * @return socket address of the remote host
      */
     SocketAddress getRemoteAddress();
-    
+
     /**
      * Returns local socket address.
-     * 
+     *
      * @return local socket address.
      */
     SocketAddress getLocalAddress();
-    
+
     /**
-     * Returns attachment object will be added to the session's context upon 
-     * initialization. This object can be used to pass an initial processing 
+     * Returns attachment object will be added to the session's context upon
+     * initialization. This object can be used to pass an initial processing
      * state to the protocol handler.
-     * 
+     *
      * @return attachment object.
      */
     Object getAttachment();
-    
+
     /**
      * Determines whether the request has been completed (either successfully
      * or unsuccessfully).
-     * 
+     *
      * @return <code>true</true> if the request has been completed,
      *  <code>false</true> if still pending.
      */
     boolean isCompleted();
-    
+
     /**
      * Returns {@link IOSession} instance created as a result of this request
      * or <code>null</code> if the request is still pending.
-     * 
+     *
      * @return I/O session or <code>null</code> if the request is still pending.
      */
     IOSession getSession();
-    
+
     /**
-     * Returns {@link IOException} instance if the request could not be 
+     * Returns {@link IOException} instance if the request could not be
      * successfully executed due to an I/O error or <code>null</code> if no
      * error occurred to this point.
-     * 
-     * @return I/O exception or <code>null</code> if no error occurred to 
+     *
+     * @return I/O exception or <code>null</code> if no error occurred to
      * this point.
      */
     IOException getException();
 
     /**
      * Waits for completion of this session request.
-     * 
-     * @throws InterruptedException in case the execution process was 
+     *
+     * @throws InterruptedException in case the execution process was
      *   interrupted.
      */
     void waitFor() throws InterruptedException;
-    
+
     /**
      * Sets connect timeout value in milliseconds.
-     * 
+     *
      * @param timeout connect timeout value in milliseconds.
      */
     void setConnectTimeout(int timeout);
-    
+
     /**
      * Returns connect timeout value in milliseconds.
-     * 
+     *
      * @return connect timeout value in milliseconds.
      */
     int getConnectTimeout();
-    
+
     /**
-     * Cancels the request. Invocation of this method will set the status of 
-     * the request to completed and will unblock threads blocked in 
+     * Cancels the request. Invocation of this method will set the status of
+     * the request to completed and will unblock threads blocked in
      * the {{@link #waitFor()}} method.
      */
     void cancel();
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequestCallback.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequestCallback.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequestCallback.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/reactor/SessionRequestCallback.java Fri Apr 23 19:11:53 2010
@@ -28,44 +28,44 @@
 package org.apache.http.nio.reactor;
 
 /**
- * SessionRequestCallback interface can be used to get notifications of 
- * completion of session requests asynchronously without having to wait 
- * for it, blocking the current thread of execution. 
+ * SessionRequestCallback interface can be used to get notifications of
+ * completion of session requests asynchronously without having to wait
+ * for it, blocking the current thread of execution.
  *
  * @since 4.0
  */
 public interface SessionRequestCallback {
 
     /**
-     * Triggered on successful completion of a {@link SessionRequest}. 
-     * The {@link SessionRequest#getSession()} method can now be used to obtain 
-     * the new I/O session. 
-     *  
+     * Triggered on successful completion of a {@link SessionRequest}.
+     * The {@link SessionRequest#getSession()} method can now be used to obtain
+     * the new I/O session.
+     *
      * @param request session request.
      */
     void completed(SessionRequest request);
-    
+
     /**
-     * Triggered on unsuccessful completion a {@link SessionRequest}. 
-     * The {@link SessionRequest#getException()} method can now be used to 
-     * obtain the cause of the error. 
-     *  
+     * Triggered on unsuccessful completion a {@link SessionRequest}.
+     * The {@link SessionRequest#getException()} method can now be used to
+     * obtain the cause of the error.
+     *
      * @param request session request.
      */
     void failed(SessionRequest request);
-    
+
     /**
-     * Triggered if a {@link SessionRequest} times out. 
-     *  
+     * Triggered if a {@link SessionRequest} times out.
+     *
      * @param request session request.
      */
     void timeout(SessionRequest request);
 
     /**
-     * Triggered on cancellation of a {@link SessionRequest}. 
-     *  
+     * Triggered on cancellation of a {@link SessionRequest}.
+     *
      * @param request session request.
      */
     void cancelled(SessionRequest request);
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/BufferInfo.java Fri Apr 23 19:11:53 2010
@@ -31,7 +31,7 @@ package org.apache.http.nio.util;
  * Basic buffer properties.
  *
  * @since 4.0
- * 
+ *
  * @deprecated Use {@link org.apache.http.io.BufferInfo}
  */
 @Deprecated

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ByteBufferAllocator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ByteBufferAllocator.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ByteBufferAllocator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ByteBufferAllocator.java Fri Apr 23 19:11:53 2010
@@ -35,13 +35,13 @@ import java.nio.ByteBuffer;
  * @since 4.0
  */
 public interface ByteBufferAllocator {
-    
+
     /**
      * Allocates {@link ByteBuffer} of the given size.
-     *  
+     *
      * @param size the size of the buffer.
      * @return byte buffer.
      */
     ByteBuffer allocate(int size);
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java Fri Apr 23 19:11:53 2010
@@ -41,18 +41,18 @@ public interface ContentInputBuffer {
     /**
      * Reads content from the given {@link ContentDecoder} and stores it in
      * this buffer.
-     * 
+     *
      * @param decoder the content decoder.
      * @return number of bytes read.
      * @throws IOException in case of an I/O error.
      */
     int consumeContent(ContentDecoder decoder) throws IOException;
-    
+
     /**
-     * Resets the buffer by clearing its state and stored content. 
+     * Resets the buffer by clearing its state and stored content.
      */
     void reset();
-    
+
     /**
      * Reads up to <code>len</code> bytes of data from this buffer into
      * an array of bytes. The exact number of bytes read depends how many bytes
@@ -60,9 +60,9 @@ public interface ContentInputBuffer {
      *
      * <p> If <code>off</code> is negative, or <code>len</code> is negative, or
      * <code>off+len</code> is greater than the length of the array
-     * <code>b</code>, this method can throw a runtime exception. The exact type 
-     * of runtime exception thrown by this method depends on implementation. 
-     * This method returns <code>-1</code> if the end of content stream has been 
+     * <code>b</code>, this method can throw a runtime exception. The exact type
+     * of runtime exception thrown by this method depends on implementation.
+     * This method returns <code>-1</code> if the end of content stream has been
      * reached.
      *
      * @param      b     the buffer into which the data is read.
@@ -75,15 +75,15 @@ public interface ContentInputBuffer {
      * @exception  IOException  if an I/O error occurs.
      */
     int read(byte[] b, int off, int len) throws IOException;
-    
+
     /**
      * Reads one byte from this buffer. If the buffer is empty this method can
      * throw a runtime exception. The exact type of runtime exception thrown
-     * by this method depends on implementation. This method returns 
-     * <code>-1</code> if the end of content stream has been reached. 
-     * 
+     * by this method depends on implementation. This method returns
+     * <code>-1</code> if the end of content stream has been reached.
+     *
      * @return one byte
      */
     int read() throws IOException;
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java Fri Apr 23 19:11:53 2010
@@ -40,18 +40,18 @@ public interface ContentOutputBuffer {
 
     /**
      * Writes content from this buffer to the given {@link ContentEncoder}.
-     *  
+     *
      * @param encoder content encoder.
      * @return number of bytes written.
      * @throws IOException in case of an I/O error.
      */
     int produceContent(ContentEncoder encoder) throws IOException;
-    
+
     /**
-     * Resets the buffer by clearing its state and stored content. 
+     * Resets the buffer by clearing its state and stored content.
      */
     void reset();
-    
+
     /**
      * @deprecated No longer used.
      */
@@ -59,12 +59,12 @@ public interface ContentOutputBuffer {
     void flush() throws IOException;
 
     /**
-     * Writes <code>len</code> bytes from the specified byte array 
+     * Writes <code>len</code> bytes from the specified byte array
      * starting at offset <code>off</code> to this buffer.
      * <p>
-     * If <code>off</code> is negative, or <code>len</code> is negative, or 
-     * <code>off+len</code> is greater than the length of the array 
-     * <code>b</code>, this method can throw a runtime exception. The exact type 
+     * If <code>off</code> is negative, or <code>len</code> is negative, or
+     * <code>off+len</code> is greater than the length of the array
+     * <code>b</code>, this method can throw a runtime exception. The exact type
      * of runtime exception thrown by this method depends on implementation.
      *
      * @param      b     the data.
@@ -81,11 +81,11 @@ public interface ContentOutputBuffer {
      * @exception  IOException  if an I/O error occurs.
      */
     void write(int b) throws IOException;
-    
+
     /**
-     * Indicates the content has been fully written. 
+     * Indicates the content has been fully written.
      * @exception  IOException  if an I/O error occurs.
      */
     void writeCompleted() throws IOException;
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/DirectByteBufferAllocator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/DirectByteBufferAllocator.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/DirectByteBufferAllocator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/DirectByteBufferAllocator.java Fri Apr 23 19:11:53 2010
@@ -30,7 +30,7 @@ package org.apache.http.nio.util;
 import java.nio.ByteBuffer;
 
 /**
- * Allocates {@link ByteBuffer} instances using 
+ * Allocates {@link ByteBuffer} instances using
  * {@link ByteBuffer#allocateDirect(int)}.
  *
  * @since 4.0

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java Fri Apr 23 19:11:53 2010
@@ -33,8 +33,8 @@ import org.apache.http.io.BufferInfo;
 
 /**
  * A buffer that expand its capacity on demand using {@link ByteBufferAllocator}
- * interface. Internally, this class is backed by an instance of 
- * {@link ByteBuffer}. 
+ * interface. Internally, this class is backed by an instance of
+ * {@link ByteBuffer}.
  * <p>
  * This class is not thread safe.
  *
@@ -42,17 +42,17 @@ import org.apache.http.io.BufferInfo;
  */
 @SuppressWarnings("deprecation")
 public class ExpandableBuffer implements BufferInfo, org.apache.http.nio.util.BufferInfo {
-    
+
     public final static int INPUT_MODE = 0;
     public final static int OUTPUT_MODE = 1;
-    
+
     private int mode;
     protected ByteBuffer buffer = null;
     private final ByteBufferAllocator allocator;
 
     /**
      * Allocates buffer of the given size using the given allocator.
-     * 
+     *
      * @param buffersize the buffer size.
      * @param allocator allocator to be used to allocate {@link ByteBuffer}s.
      */
@@ -72,7 +72,7 @@ public class ExpandableBuffer implements
      * {@link #INPUT_MODE}: the buffer is in the input mode.
      * <p>
      * {@link #OUTPUT_MODE}: the buffer is in the output mode.
-     * 
+     *
      * @return current input/output mode.
      */
     protected int getMode() {
@@ -88,9 +88,9 @@ public class ExpandableBuffer implements
             this.mode = OUTPUT_MODE;
         }
     }
-    
+
     /**
-     * Sets input mode. The buffer can now be written into. 
+     * Sets input mode. The buffer can now be written into.
      */
     protected void setInputMode() {
         if (this.mode != INPUT_MODE) {
@@ -102,14 +102,14 @@ public class ExpandableBuffer implements
             this.mode = INPUT_MODE;
         }
     }
-    
+
     private void expandCapacity(int capacity) {
         ByteBuffer oldbuffer = this.buffer;
         this.buffer = allocator.allocate(capacity);
         oldbuffer.flip();
         this.buffer.put(oldbuffer);
     }
-    
+
     /**
      * Expands buffer's capacity.
      */
@@ -120,10 +120,10 @@ public class ExpandableBuffer implements
         }
         expandCapacity(newcapacity);
     }
-    
+
     /**
      * Ensures the buffer can accommodate the required capacity.
-     * 
+     *
      * @param requiredCapacity
      */
     protected void ensureCapacity(int requiredCapacity) {
@@ -131,19 +131,19 @@ public class ExpandableBuffer implements
             expandCapacity(requiredCapacity);
         }
     }
-    
+
     /**
      * Returns the total capacity of this buffer.
-     * 
+     *
      * @return total capacity.
      */
     public int capacity() {
         return this.buffer.capacity();
     }
- 
+
     /**
      * Determines if the buffer contains data.
-     * 
+     *
      * @return <code>true</code> if there is data in the buffer,
      *   <code>false</code> otherwise.
      */
@@ -151,32 +151,32 @@ public class ExpandableBuffer implements
         setOutputMode();
         return this.buffer.hasRemaining();
     }
-    
+
     /**
      * Returns the length of this buffer.
-     * 
+     *
      * @return buffer length.
      */
     public int length() {
         setOutputMode();
         return this.buffer.remaining();
     }
-    
+
     /**
      * Returns available capacity of this buffer.
-     * 
+     *
      * @return buffer length.
      */
     public int available() {
         setInputMode();
         return this.buffer.remaining();
     }
-    
+
     /**
      * Clears buffer.
      */
     protected void clear() {
-        this.buffer.clear();        
+        this.buffer.clear();
         this.mode = INPUT_MODE;
     }
 
@@ -199,5 +199,5 @@ public class ExpandableBuffer implements
         sb.append("]");
         return sb.toString();
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/HeapByteBufferAllocator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/HeapByteBufferAllocator.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/HeapByteBufferAllocator.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/HeapByteBufferAllocator.java Fri Apr 23 19:11:53 2010
@@ -30,7 +30,7 @@ package org.apache.http.nio.util;
 import java.nio.ByteBuffer;
 
 /**
- * Allocates {@link ByteBuffer} instances using 
+ * Allocates {@link ByteBuffer} instances using
  * {@link ByteBuffer#allocate(int)}.
  *
  * @since 4.0

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java Fri Apr 23 19:11:53 2010
@@ -33,12 +33,12 @@ import org.apache.http.nio.ContentDecode
 import org.apache.http.nio.IOControl;
 
 /**
- * Implementation of the {@link ContentInputBuffer} interface that can be 
+ * Implementation of the {@link ContentInputBuffer} interface that can be
  * shared by multiple threads, usually the I/O dispatch of an I/O reactor and
- * a worker thread. 
+ * a worker thread.
  * <p>
- * Please note this class is thread safe only when used though 
- * the {@link ContentInputBuffer} interface. 
+ * Please note this class is thread safe only when used though
+ * the {@link ContentInputBuffer} interface.
  *
  * @since 4.0
  */
@@ -46,10 +46,10 @@ public class SharedInputBuffer extends E
 
     private final IOControl ioctrl;
     private final Object mutex;
-    
+
     private volatile boolean shutdown = false;
     private volatile boolean endOfStream = false;
-    
+
     public SharedInputBuffer(int buffersize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
         super(buffersize, allocator);
         if (ioctrl == null) {
@@ -58,7 +58,7 @@ public class SharedInputBuffer extends E
         this.ioctrl = ioctrl;
         this.mutex = new Object();
     }
-    
+
     public void reset() {
         if (this.shutdown) {
             return;
@@ -68,7 +68,7 @@ public class SharedInputBuffer extends E
             this.endOfStream = false;
         }
     }
-    
+
     public int consumeContent(final ContentDecoder decoder) throws IOException {
         if (this.shutdown) {
             return -1;
@@ -78,7 +78,7 @@ public class SharedInputBuffer extends E
             int totalRead = 0;
             int bytesRead;
             while ((bytesRead = decoder.read(this.buffer)) > 0) {
-                totalRead += bytesRead; 
+                totalRead += bytesRead;
             }
             if (bytesRead == -1 || decoder.isCompleted()) {
                 this.endOfStream = true;
@@ -87,7 +87,7 @@ public class SharedInputBuffer extends E
                 this.ioctrl.suspendInput();
             }
             this.mutex.notifyAll();
-            
+
             if (totalRead > 0) {
                 return totalRead;
             } else {
@@ -99,7 +99,7 @@ public class SharedInputBuffer extends E
             }
         }
     }
-    
+
     @Override
     public int available() {
         synchronized (this.mutex) {
@@ -174,7 +174,7 @@ public class SharedInputBuffer extends E
                 waitForData();
             }
             if (isEndOfStream()) {
-                return -1; 
+                return -1;
             }
             return this.buffer.get() & 0xff;
         }
@@ -192,7 +192,7 @@ public class SharedInputBuffer extends E
                 waitForData();
             }
             if (isEndOfStream()) {
-                return -1; 
+                return -1;
             }
             setOutputMode();
             int chunk = len;

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java Fri Apr 23 19:11:53 2010
@@ -33,12 +33,12 @@ import org.apache.http.nio.ContentEncode
 import org.apache.http.nio.IOControl;
 
 /**
- * Implementation of the {@link ContentOutputBuffer} interface that can be 
+ * Implementation of the {@link ContentOutputBuffer} interface that can be
  * shared by multiple threads, usually the I/O dispatch of an I/O reactor and
  * a worker thread.
  * <p>
- * Please note this class is thread safe only when used though 
- * the {@link ContentOutputBuffer} interface. 
+ * Please note this class is thread safe only when used though
+ * the {@link ContentOutputBuffer} interface.
  *
  * @since 4.0
  */
@@ -46,10 +46,10 @@ public class SharedOutputBuffer extends 
 
     private final IOControl ioctrl;
     private final Object mutex;
-    
+
     private volatile boolean shutdown = false;
     private volatile boolean endOfStream = false;
-    
+
     public SharedOutputBuffer(int buffersize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
         super(buffersize, allocator);
         if (ioctrl == null) {
@@ -68,7 +68,7 @@ public class SharedOutputBuffer extends 
             this.endOfStream = false;
         }
     }
-    
+
     @Override
     public int available() {
         synchronized (this.mutex) {
@@ -108,17 +108,17 @@ public class SharedOutputBuffer extends 
                 // If at the end of the stream, terminate
                 if (this.endOfStream && !encoder.isCompleted()) {
                     encoder.complete();
-                } 
+                }
                 if (!this.endOfStream) {
                     // suspend output events
                     this.ioctrl.suspendOutput();
                 }
             }
-            this.mutex.notifyAll();            
+            this.mutex.notifyAll();
             return bytesWritten;
         }
     }
-    
+
     public void close() {
         shutdown();
     }
@@ -195,7 +195,7 @@ public class SharedOutputBuffer extends 
             }
         }
     }
-    
+
     public void writeCompleted() throws IOException {
         synchronized (this.mutex) {
             if (this.endOfStream) {
@@ -205,5 +205,5 @@ public class SharedOutputBuffer extends 
             this.ioctrl.requestOutput();
         }
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java Fri Apr 23 19:11:53 2010
@@ -33,23 +33,23 @@ import org.apache.http.nio.ContentDecode
 /**
  * Basic implementation of the {@link ContentInputBuffer} interface.
  * <p>
- * This class is not thread safe. 
+ * This class is not thread safe.
  *
  * @since 4.0
  */
 public class SimpleInputBuffer extends ExpandableBuffer implements ContentInputBuffer {
 
     private boolean endOfStream = false;
-    
+
     public SimpleInputBuffer(int buffersize, final ByteBufferAllocator allocator) {
         super(buffersize, allocator);
     }
-    
+
     public void reset() {
         this.endOfStream = false;
         super.clear();
     }
-    
+
     public int consumeContent(final ContentDecoder decoder) throws IOException {
         setInputMode();
         int totalRead = 0;
@@ -70,21 +70,21 @@ public class SimpleInputBuffer extends E
         }
         return totalRead;
     }
-    
+
     public boolean isEndOfStream() {
         return !hasData() && this.endOfStream;
     }
 
     public int read() throws IOException {
         if (isEndOfStream()) {
-            return -1; 
+            return -1;
         }
         return this.buffer.get() & 0xff;
     }
 
     public int read(final byte[] b, int off, int len) throws IOException {
         if (isEndOfStream()) {
-            return -1; 
+            return -1;
         }
         if (b == null) {
             return 0;
@@ -100,7 +100,7 @@ public class SimpleInputBuffer extends E
 
     public int read(final byte[] b) throws IOException {
         if (isEndOfStream()) {
-            return -1; 
+            return -1;
         }
         if (b == null) {
             return 0;
@@ -111,5 +111,5 @@ public class SimpleInputBuffer extends E
     public void shutdown() {
         this.endOfStream = true;
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java Fri Apr 23 19:11:53 2010
@@ -31,16 +31,16 @@ import java.io.IOException;
 import org.apache.http.nio.ContentEncoder;
 
 /**
- * Basic implementation of the {@link ContentOutputBuffer} interface. 
+ * Basic implementation of the {@link ContentOutputBuffer} interface.
  * <p>
- * This class is not thread safe. 
+ * This class is not thread safe.
  *
  * @since 4.0
  */
 public class SimpleOutputBuffer extends ExpandableBuffer implements ContentOutputBuffer {
-    
+
     private boolean endOfStream;
-    
+
     public SimpleOutputBuffer(int buffersize, final ByteBufferAllocator allocator) {
         super(buffersize, allocator);
         this.endOfStream = false;
@@ -54,7 +54,7 @@ public class SimpleOutputBuffer extends 
         }
         return bytesWritten;
     }
-    
+
     public void write(final byte[] b, int off, int len) throws IOException {
         if (b == null) {
             return;
@@ -85,21 +85,21 @@ public class SimpleOutputBuffer extends 
         ensureCapacity(this.capacity() + 1);
         this.buffer.put((byte)b);
     }
-    
+
     public void reset() {
         super.clear();
         this.endOfStream = false;
     }
-    
+
     public void flush() {
     }
 
     public void writeCompleted() {
         this.endOfStream = true;
     }
-    
+
     public void shutdown() {
         this.endOfStream = true;
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOSSLTestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOSSLTestBase.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOSSLTestBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOSSLTestBase.java Fri Apr 23 19:11:53 2010
@@ -49,7 +49,7 @@ public class HttpCoreNIOSSLTestBase exte
 
     protected TestHttpSSLServer server;
     protected TestHttpSSLClient client;
-    
+
     @Override
     protected void setUp() throws Exception {
         HttpParams serverParams = new SyncBasicHttpParams();
@@ -59,10 +59,10 @@ public class HttpCoreNIOSSLTestBase exte
             .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
             .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "TEST-SERVER/1.1");
-        
+
         this.server = new TestHttpSSLServer(serverParams);
         this.server.setExceptionHandler(new SimpleIOReactorExceptionHandler());
-        
+
         HttpParams clientParams = new SyncBasicHttpParams();
         clientParams
             .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 120000)
@@ -71,7 +71,7 @@ public class HttpCoreNIOSSLTestBase exte
             .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
             .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
             .setParameter(CoreProtocolPNames.USER_AGENT, "TEST-CLIENT/1.1");
-        
+
         this.client = new TestHttpSSLClient(clientParams);
         this.client.setExceptionHandler(new SimpleIOReactorExceptionHandler());
     }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOTestBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOTestBase.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOTestBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/HttpCoreNIOTestBase.java Fri Apr 23 19:11:53 2010
@@ -50,7 +50,7 @@ public class HttpCoreNIOTestBase extends
 
     protected TestHttpServer server;
     protected TestHttpClient client;
-    
+
     @Override
     protected void setUp() throws Exception {
         HttpParams serverParams = new SyncBasicHttpParams();

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/OoopsieRuntimeException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/OoopsieRuntimeException.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/OoopsieRuntimeException.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/OoopsieRuntimeException.java Fri Apr 23 19:11:53 2010
@@ -34,5 +34,5 @@ public class OoopsieRuntimeException ext
     public OoopsieRuntimeException() {
         super("Ooopsie!!!");
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/SimpleIOReactorExceptionHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/SimpleIOReactorExceptionHandler.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/SimpleIOReactorExceptionHandler.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/SimpleIOReactorExceptionHandler.java Fri Apr 23 19:11:53 2010
@@ -43,5 +43,5 @@ class SimpleIOReactorExceptionHandler im
         ex.printStackTrace(System.out);
         return false;
     }
-    
+
 }
\ No newline at end of file

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkDecoder.java Fri Apr 23 19:11:53 2010
@@ -45,7 +45,7 @@ import org.apache.http.params.HttpParams
 /**
  * Simple tests for {@link ChunkDecoder}.
  *
- * 
+ *
  * @version $Id$
  */
 public class TestChunkDecoder extends TestCase {
@@ -59,7 +59,7 @@ public class TestChunkDecoder extends Te
 
     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));
         }
@@ -69,15 +69,15 @@ public class TestChunkDecoder extends Te
     public void testBasicDecoding() throws Exception {
         String s = "5\r\n01234\r\n5\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n";
         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);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(16, bytesRead);
         assertEquals("0123456789abcdef", convert(dst));
@@ -94,14 +94,14 @@ public class TestChunkDecoder extends Te
         String s = "10;key=\"value\"\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1: abcde\r\nFooter2: fghij\r\n\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
 
         int bytesRead = 0;
         while (dst.hasRemaining() && !decoder.isCompleted()) {
@@ -110,17 +110,17 @@ public class TestChunkDecoder extends Te
                 bytesRead += i;
             }
         }
-        
+
         assertEquals(26, bytesRead);
         assertEquals("12345678901234561234512345", convert(dst));
-        
+
         Header[] footers = decoder.getFooters();
         assertEquals(2, footers.length);
         assertEquals("Footer1", footers[0].getName());
         assertEquals("abcde", footers[0].getValue());
         assertEquals("Footer2", footers[1].getName());
         assertEquals("fghij", footers[1].getValue());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
@@ -131,15 +131,15 @@ public class TestChunkDecoder extends Te
         String s1 = "5\r\n01234\r\n5\r\n5678";
         String s2 = "9\r\n6\r\nabcdef\r\n0\r\n\r\n";
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                new String[] {s1, s2}, "US-ASCII"); 
+                new String[] {s1, s2}, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-        
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        ByteBuffer tmp = ByteBuffer.allocate(4); 
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+        ByteBuffer tmp = ByteBuffer.allocate(4);
 
         int bytesRead = 0;
         while (dst.hasRemaining() && !decoder.isCompleted()) {
@@ -151,7 +151,7 @@ public class TestChunkDecoder extends Te
             dst.put(tmp);
             tmp.compact();
         }
-        
+
         assertEquals(16, bytesRead);
         assertEquals("0123456789abcdef", convert(dst));
         assertTrue(decoder.isCompleted());
@@ -175,15 +175,15 @@ public class TestChunkDecoder extends Te
                 "ghij\r\n\r\n"
         };
         ReadableByteChannel channel = new ReadableByteChannelMockup(
-                chunks, "US-ASCII"); 
+                chunks, "US-ASCII");
         HttpParams params = new BasicHttpParams();
-    
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params); 
+
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
+
         int bytesRead = 0;
         while (dst.hasRemaining() && !decoder.isCompleted()) {
             int i = decoder.read(dst);
@@ -191,11 +191,11 @@ public class TestChunkDecoder extends Te
                 bytesRead += i;
             }
         }
-        
+
         assertEquals(27, bytesRead);
         assertEquals("123456789012345612345abcdef", convert(dst));
         assertTrue(decoder.isCompleted());
-        
+
         Header[] footers = decoder.getFooters();
         assertEquals(2, footers.length);
         assertEquals("Footer1", footers[0].getName());
@@ -208,19 +208,19 @@ public class TestChunkDecoder extends Te
         assertEquals(-1, bytesRead);
         assertTrue(decoder.isCompleted());
     }
-    
+
     public void testMalformedChunkSizeDecoding() throws Exception {
         String s = "5\r\n01234\r\n5zz\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         try {
             decoder.read(dst);
             fail("MalformedChunkCodingException should have been thrown");
@@ -232,15 +232,15 @@ public class TestChunkDecoder extends Te
     public void testMalformedChunkEndingDecoding() throws Exception {
         String s = "5\r\n01234\r\n5\r\n56789\n\r6\r\nabcdef\r\n0\r\n\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         try {
             decoder.read(dst);
             fail("MalformedChunkCodingException should have been thrown");
@@ -252,14 +252,14 @@ public class TestChunkDecoder extends Te
     public void testMalformedChunkTruncatedChunk() throws Exception {
         String s = "3\r\n12";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
         assertEquals(2, decoder.read(dst));
         try {
             decoder.read(dst);
@@ -273,19 +273,19 @@ public class TestChunkDecoder extends Te
         String s = "10;key=\"value\"\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1: abcde\r\n   \r\n  fghij\r\n\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(26, bytesRead);
         assertEquals("12345678901234561234512345", convert(dst));
-        
+
         Header[] footers = decoder.getFooters();
         assertEquals(1, footers.length);
         assertEquals("Footer1", footers[0].getName());
@@ -296,15 +296,15 @@ public class TestChunkDecoder extends Te
         String s = "10;key=\"value\"\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1 abcde\r\n\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         try {
             decoder.read(dst);
             fail("MalformedChunkCodingException should have been thrown");
@@ -317,14 +317,14 @@ public class TestChunkDecoder extends Te
         String s = "10\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
 
         int bytesRead = 0;
         while (dst.hasRemaining() && !decoder.isCompleted()) {
@@ -333,7 +333,7 @@ public class TestChunkDecoder extends Te
                 bytesRead += i;
             }
         }
-        
+
         assertEquals(26, bytesRead);
         assertEquals("12345678901234561234512345", convert(dst));
         assertTrue(decoder.isCompleted());
@@ -344,15 +344,15 @@ public class TestChunkDecoder extends Te
                 "40\r\n12345678901234561234567890123456" +
                 "12345678901234561234567890123456\r\n0\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        ByteBuffer tmp = ByteBuffer.allocate(10); 
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+        ByteBuffer tmp = ByteBuffer.allocate(10);
 
         int bytesRead = 0;
         while (dst.hasRemaining() && !decoder.isCompleted()) {
@@ -364,7 +364,7 @@ public class TestChunkDecoder extends Te
                 tmp.compact();
             }
         }
-        
+
         assertEquals(80, bytesRead);
         assertEquals("12345678901234561234567890123456" +
                 "12345678901234561234567890123456" +
@@ -376,14 +376,14 @@ public class TestChunkDecoder extends Te
         String s = "10\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n0\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
 
         int bytesRead = 0;
         while (dst.hasRemaining() && !decoder.isCompleted()) {
@@ -392,7 +392,7 @@ public class TestChunkDecoder extends Te
                 bytesRead += i;
             }
         }
-        
+
         assertEquals(26, bytesRead);
         assertEquals("12345678901234561234512345", convert(dst));
         assertTrue(decoder.isCompleted());
@@ -400,10 +400,10 @@ public class TestChunkDecoder extends Te
 
     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);
         try {
             new ChunkDecoder(null, null, null);
             fail("IllegalArgumentException should have been thrown");
@@ -423,18 +423,18 @@ public class TestChunkDecoder extends Te
             // ignore
         }
     }
-    
+
     public void testInvalidInput() throws Exception {
         String s = "10;key=\"value\"\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n0\r\nFooter1 abcde\r\n\r\n";
         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();
         ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
-        
+
         try {
             decoder.read(null);
             fail("IllegalArgumentException should have been thrown");

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestChunkEncoder.java Fri Apr 23 19:11:53 2010
@@ -44,7 +44,7 @@ import org.apache.http.util.EncodingUtil
 /**
  * Simple tests for {@link ChunkEncoder}.
  *
- * 
+ *
  * @version $Id$
  */
 public class TestChunkEncoder extends TestCase {
@@ -59,34 +59,34 @@ public class TestChunkEncoder extends Te
     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);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         ChunkEncoder encoder = new ChunkEncoder(channel, outbuf, metrics);
-        
+
         encoder.write(wrap("12345"));
         encoder.write(wrap("678"));
         encoder.write(wrap("90"));
         encoder.complete();
-        
+
         outbuf.flush(channel);
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("5\r\n12345\r\n3\r\n678\r\n2\r\n90\r\n0\r\n\r\n", s);
     }
-    
+
     public void testChunkNoExceed() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 16, params);
@@ -94,26 +94,26 @@ public class TestChunkEncoder extends Te
         ChunkEncoder encoder = new ChunkEncoder(channel, outbuf, metrics);
         encoder.write(wrap("1234"));
         encoder.complete();
-        
+
         outbuf.flush(channel);
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
-        assertEquals("4\r\n1234\r\n0\r\n\r\n", s);    
+        assertEquals("4\r\n1234\r\n0\r\n\r\n", s);
     }
-    
-    
+
+
     public void testChunkExceed() throws Exception {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         WritableByteChannel channel = newChannel(baos);
         HttpParams params = new BasicHttpParams();
         SessionOutputBuffer outbuf = new SessionOutputBufferImpl(16, 16, params);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         ChunkEncoder encoder = new ChunkEncoder(channel, outbuf, metrics);
-        
+
         ByteBuffer src = wrap("0123456789ABCDEF");
-        
+
         assertEquals(6, encoder.write(src));
         assertTrue(src.hasRemaining());
         assertEquals(10, src.remaining());
@@ -124,48 +124,48 @@ public class TestChunkEncoder extends Te
 
         assertEquals(4, encoder.write(src));
         assertFalse(src.hasRemaining());
-        
+
         outbuf.flush(channel);
         String s = baos.toString("US-ASCII");
-        assertEquals("6\r\n012345\r\n6\r\n6789AB\r\n4\r\nCDEF\r\n", s);    
-        
+        assertEquals("6\r\n012345\r\n6\r\n6789AB\r\n4\r\nCDEF\r\n", 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);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         ChunkEncoder encoder = new ChunkEncoder(channel, outbuf, metrics);
-        
+
         encoder.write(wrap("12345"));
         encoder.write(wrap("678"));
         encoder.write(wrap("90"));
-        
+
         ByteBuffer empty = ByteBuffer.allocate(100);
         empty.flip();
         encoder.write(empty);
         encoder.write(null);
-        
+
         encoder.complete();
-        
+
         outbuf.flush(channel);
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("5\r\n12345\r\n3\r\n678\r\n2\r\n90\r\n0\r\n\r\n", 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);
         HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         ChunkEncoder encoder = new ChunkEncoder(channel, outbuf, metrics);
-        
+
         encoder.write(wrap("12345"));
         encoder.write(wrap("678"));
         encoder.write(wrap("90"));
@@ -186,7 +186,7 @@ public class TestChunkEncoder extends Te
     }
 
     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);
@@ -210,5 +210,5 @@ public class TestChunkEncoder extends Te
             // ignore
         }
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestHttpMessageParser.java Fri Apr 23 19:11:53 2010
@@ -62,19 +62,19 @@ public class TestHttpMessageParser exten
 
     // ------------------------------------------------------- TestCase Methods
 
-    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 testSimpleParsing() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
         requestParser.fillBuffer(newChannel("GET /whatever HTTP/1.1\r\nSome header: stuff\r\n\r\n"));
@@ -86,7 +86,7 @@ public class TestHttpMessageParser exten
 
     public void testParsingChunkedMessages() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
 
@@ -102,12 +102,12 @@ public class TestHttpMessageParser exten
         assertNotNull(request);
         assertEquals("/whatever", request.getRequestLine().getUri());
         assertEquals(1, request.getAllHeaders().length);
-        
+
     }
 
     public void testParsingFoldedHeaders() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
 
@@ -134,10 +134,10 @@ public class TestHttpMessageParser exten
         assertEquals(1, request.getAllHeaders().length);
         assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue());
     }
-    
+
     public void testParsingBadlyFoldedFirstHeader() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
 
@@ -161,10 +161,10 @@ public class TestHttpMessageParser exten
         assertEquals(1, request.getAllHeaders().length);
         assertEquals("stuff more stuff", request.getFirstHeader("Some header").getValue());
     }
-    
+
     public void testParsingEmptyFoldedHeader() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
 
@@ -191,13 +191,13 @@ public class TestHttpMessageParser exten
         assertEquals(1, request.getAllHeaders().length);
         assertEquals("stuff  more stuff", request.getFirstHeader("Some header").getValue());
     }
-    
+
     public void testParsingIncompleteRequestLine() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
-        
+
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0");
         requestParser.fillBuffer(channel);
         requestParser.fillBuffer(channel);
@@ -205,13 +205,13 @@ public class TestHttpMessageParser exten
         assertNotNull(request);
         assertEquals(HttpVersion.HTTP_1_0, request.getRequestLine().getProtocolVersion());
     }
-    
+
     public void testParsingIncompleteHeader() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
-        
+
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: whatever");
         requestParser.fillBuffer(channel);
         requestParser.fillBuffer(channel);
@@ -220,13 +220,13 @@ public class TestHttpMessageParser exten
         assertEquals(1, request.getAllHeaders().length);
         assertEquals("whatever", request.getFirstHeader("Header").getValue());
     }
-    
+
     public void testParsingInvalidRequestLine() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
-        
+
         ReadableByteChannel channel = newChannel("GET garbage\r\n");
         requestParser.fillBuffer(channel);
         try {
@@ -236,13 +236,13 @@ public class TestHttpMessageParser exten
             // expected
         }
     }
-    
+
     public void testParsingInvalidStatusLine() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
         NHttpMessageParser<HttpResponse> responseParser = new DefaultHttpResponseParser(inbuf, null, responseFactory, params);
-        
+
         ReadableByteChannel channel = newChannel("HTTP 200 OK\r\n");
         responseParser.fillBuffer(channel);
         try {
@@ -252,13 +252,13 @@ public class TestHttpMessageParser exten
             // expected
         }
     }
-    
+
     public void testParsingInvalidHeader() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpResponseFactory responseFactory = new DefaultHttpResponseFactory();
         NHttpMessageParser<HttpResponse> responseParser = new DefaultHttpResponseParser(inbuf, null, responseFactory, params);
-        
+
         ReadableByteChannel channel = newChannel("HTTP/1.0 200 OK\r\nstuff\r\n\r\n");
         responseParser.fillBuffer(channel);
         try {
@@ -268,20 +268,20 @@ public class TestHttpMessageParser exten
             // expected
         }
     }
-    
+
     public void testResetParser() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
-        
+
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n");
         requestParser.fillBuffer(channel);
         HttpRequest request = requestParser.parse();
         assertNotNull(request);
         assertEquals(1, request.getAllHeaders().length);
         assertEquals("one", request.getFirstHeader("Header").getValue());
-        
+
         requestParser.reset();
 
         channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: two\r\n\r\n");
@@ -291,10 +291,10 @@ public class TestHttpMessageParser exten
         assertEquals(1, request.getAllHeaders().length);
         assertEquals("two", request.getFirstHeader("Header").getValue());
     }
-    
+
     public void testInvalidConstructor() {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         try {
             new DefaultHttpRequestParser(null, null, null, params);
             fail("IllegalArgumentException should have been thrown");
@@ -323,7 +323,7 @@ public class TestHttpMessageParser exten
 
     public void testLineLimitForStatus() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
 
         params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 0);
@@ -344,7 +344,7 @@ public class TestHttpMessageParser exten
 
     public void testLineLimitForHeader() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
 
         params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 0);
@@ -368,11 +368,11 @@ public class TestHttpMessageParser exten
 
     public void testLineLimitForFoldedHeader() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
 
         params.setIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, 2);
-        params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 15);        
+        params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 15);
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(inbuf, null, requestFactory, params);
         try {
             requestParser.fillBuffer(newChannel("GET / HTTP/1.0\r\nHeader: 9012345\r\n 23456789012345\r\n 23456789012345\r\n 23456789012345\r\n\r\n"));
@@ -384,7 +384,7 @@ public class TestHttpMessageParser exten
 
     public void testMaxHeaderCount() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
 
         params.setIntParameter(CoreConnectionPNames.MAX_HEADER_COUNT, 2);
@@ -403,7 +403,7 @@ public class TestHttpMessageParser exten
 
     public void testDetectLineLimitEarly() throws Exception {
         HttpParams params = new BasicHttpParams();
-        SessionInputBuffer inbuf = new SessionInputBufferImpl(2, 128, params); 
+        SessionInputBuffer inbuf = new SessionInputBufferImpl(2, 128, params);
         HttpRequestFactory requestFactory = new DefaultHttpRequestFactory();
 
         params.setIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, 2);

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityDecoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityDecoder.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 TestIdentityDecoder extends TestCase {
@@ -62,13 +62,13 @@ public class TestIdentityDecoder extends
 
     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,28 +87,28 @@ public class TestIdentityDecoder extends
 
     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();
-        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
+
+        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));
         assertFalse(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
@@ -121,42 +121,42 @@ public class TestIdentityDecoder extends
         assertTrue(decoder.isCompleted());
         assertEquals(16, metrics.getBytesTransferred());
     }
-    
+
     public void testDecodingFromSessionBuffer() 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());
-        
-        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics); 
-        
-        ByteBuffer dst = ByteBuffer.allocate(1024); 
-        
+
+        IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
+
+        ByteBuffer dst = ByteBuffer.allocate(1024);
+
         int bytesRead = decoder.read(dst);
         assertEquals(6, bytesRead);
         assertEquals("stuff;", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(0, metrics.getBytesTransferred()); // doesn't count if from session buffer
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(10, bytesRead);
         assertEquals("more stuff", convert(dst));
         assertFalse(decoder.isCompleted());
         assertEquals(10, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
         assertTrue(decoder.isCompleted());
         assertEquals(10, metrics.getBytesTransferred());
-        
+
         dst.clear();
         bytesRead = decoder.read(dst);
         assertEquals(-1, bytesRead);
@@ -167,19 +167,19 @@ public class TestIdentityDecoder extends
 
     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();
         IdentityDecoder decoder = new IdentityDecoder(
-                channel, inbuf, metrics); 
-        
+                channel, inbuf, metrics);
+
         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);
@@ -187,15 +187,15 @@ public class TestIdentityDecoder extends
                 pos += bytesRead;
             }
         }
-        
+
         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());
@@ -204,22 +204,22 @@ public class TestIdentityDecoder extends
 
     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();
         IdentityDecoder decoder = new IdentityDecoder(
-                channel, inbuf, metrics); 
-        
+                channel, inbuf, metrics);
+
         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);
@@ -227,39 +227,39 @@ public class TestIdentityDecoder extends
                 pos += bytesRead;
             }
         }
-        
+
         // count everything except the initial 7 bytes that went to the session buffer
         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();
         IdentityDecoder decoder = new IdentityDecoder(
-                channel, inbuf, metrics); 
-        
+                channel, inbuf, metrics);
+
         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)
@@ -269,47 +269,47 @@ public class TestIdentityDecoder extends
                 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();
         IdentityDecoder decoder = new IdentityDecoder(
-                channel, inbuf, metrics); 
-        
+                channel, inbuf, metrics);
+
         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();        
+        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);
         try {
             new IdentityDecoder(null, null, null);
             fail("IllegalArgumentException should have been thrown");
@@ -329,17 +329,17 @@ public class TestIdentityDecoder extends
             // ignore
         }
     }
-    
+
     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();
         IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
-        
+
         try {
             decoder.read(null);
             fail("IllegalArgumentException should have been thrown");
@@ -347,5 +347,5 @@ public class TestIdentityDecoder extends
             // expected
         }
     }
-    
+
 }

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java?rev=937477&r1=937476&r2=937477&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/impl/nio/codecs/TestIdentityEncoder.java Fri Apr 23 19:11:53 2010
@@ -44,7 +44,7 @@ import org.apache.http.util.EncodingUtil
 /**
  * Simple tests for {@link IdentityEncoder}.
  *
- * 
+ *
  * @version $Id$
  */
 public class TestIdentityEncoder extends TestCase {
@@ -59,11 +59,11 @@ public class TestIdentityEncoder extends
     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();
         WritableByteChannel channel = newChannel(baos);
@@ -74,15 +74,15 @@ public class TestIdentityEncoder extends
         IdentityEncoder encoder = new IdentityEncoder(channel, outbuf, metrics);
         encoder.write(wrap("stuff"));
         encoder.complete();
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("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);
@@ -90,22 +90,22 @@ public class TestIdentityEncoder extends
 
         IdentityEncoder encoder = new IdentityEncoder(channel, outbuf, metrics);
         encoder.write(wrap("stuff"));
-        
+
         ByteBuffer empty = ByteBuffer.allocate(100);
         empty.flip();
         encoder.write(empty);
         encoder.write(null);
-        
+
         encoder.complete();
-        
+
         String s = baos.toString("US-ASCII");
-        
+
         assertTrue(encoder.isCompleted());
         assertEquals("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);
@@ -124,7 +124,7 @@ public class TestIdentityEncoder extends
     }
 
     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);
@@ -148,5 +148,5 @@ public class TestIdentityEncoder extends
             // ignore
         }
     }
-    
+
 }



Mime
View raw message