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 2012/09/19 18:03:53 UTC

svn commit: r1387655 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/impl/nio/ httpcore/src/main/java/org/apache/http/impl/ httpcore/src/main/java/org/apache/http/impl/entity/ httpcore/src/main/java/org/apache/http/impl/...

Author: olegk
Date: Wed Sep 19 16:03:53 2012
New Revision: 1387655

URL: http://svn.apache.org/viewvc?rev=1387655&view=rev
Log:
 Rewrite of blocking HTTP connection implementations: moved more common code to BHttpConnectionBase, deprecated EntityDeserializer and EntitySerializer, fixed error messages in EncodingUtils

Added:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java   (with props)
Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntityDeserializer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntitySerializer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EncodingUtils.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntityDeserializer.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntitySerializer.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java Wed Sep 19 16:03:53 2012
@@ -82,6 +82,7 @@ import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.Args;
 import org.apache.http.util.CharsetUtils;
+import org.apache.http.util.NetUtils;
 
 /**
  * This class serves as a base for all {@link NHttpConnection} implementations
@@ -464,27 +465,15 @@ public class NHttpConnectionBase
         return this.connMetrics;
     }
 
-    private static void formatAddress(final StringBuilder buffer, final SocketAddress socketAddress) {
-        if (socketAddress instanceof InetSocketAddress) {
-            InetSocketAddress addr = ((InetSocketAddress) socketAddress);
-            buffer.append(addr.getAddress() != null ? addr.getAddress().getHostAddress() :
-                addr.getAddress())
-            .append(':')
-            .append(addr.getPort());
-        } else {
-            buffer.append(socketAddress);
-        }
-    }
-
     @Override
     public String toString() {
         StringBuilder buffer = new StringBuilder();
         SocketAddress remoteAddress = this.session.getRemoteAddress();
         SocketAddress localAddress = this.session.getLocalAddress();
         if (remoteAddress != null && localAddress != null) {
-            formatAddress(buffer, localAddress);
+            NetUtils.formatAddress(buffer, localAddress);
             buffer.append("<->");
-            formatAddress(buffer, remoteAddress);
+            NetUtils.formatAddress(buffer, remoteAddress);
         }
         buffer.append("[");
         switch (this.status) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java Wed Sep 19 16:03:53 2012
@@ -28,8 +28,9 @@
 package org.apache.http.impl;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.InetAddress;
-import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.SocketException;
@@ -40,20 +41,38 @@ import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CodingErrorAction;
 
 import org.apache.http.Consts;
+import org.apache.http.Header;
 import org.apache.http.HttpConnection;
 import org.apache.http.HttpConnectionMetrics;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpException;
 import org.apache.http.HttpInetConnection;
+import org.apache.http.HttpMessage;
 import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.entity.ContentLengthStrategy;
+import org.apache.http.impl.entity.LaxContentLengthStrategy;
+import org.apache.http.impl.entity.StrictContentLengthStrategy;
+import org.apache.http.impl.io.ChunkedInputStream;
+import org.apache.http.impl.io.ChunkedOutputStream;
+import org.apache.http.impl.io.ContentLengthInputStream;
+import org.apache.http.impl.io.ContentLengthOutputStream;
 import org.apache.http.impl.io.HttpTransportMetricsImpl;
+import org.apache.http.impl.io.IdentityInputStream;
+import org.apache.http.impl.io.IdentityOutputStream;
 import org.apache.http.impl.io.SessionInputBufferImpl;
 import org.apache.http.impl.io.SessionOutputBufferImpl;
 import org.apache.http.io.HttpTransportMetrics;
+import org.apache.http.io.SessionInputBuffer;
+import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HTTP;
 import org.apache.http.util.Args;
 import org.apache.http.util.Asserts;
 import org.apache.http.util.CharsetUtils;
+import org.apache.http.util.NetUtils;
 
 /**
  * Implementation of a client-side HTTP connection that can be bound to an
@@ -82,9 +101,14 @@ public class BHttpConnectionBase impleme
     private final HttpTransportMetricsImpl inTransportMetrics;
     private final HttpTransportMetricsImpl outTransportMetrics;
     private final HttpConnectionMetricsImpl connMetrics;
+    private final ContentLengthStrategy incomingContentStrategy;
+    private final ContentLengthStrategy outgoingContentStrategy;
+
+    private InputStream instream;
+    private OutputStream outstream;
 
     private volatile boolean open;
-    private volatile Socket socket = null;
+    private volatile Socket socket;
 
     public BHttpConnectionBase(final HttpParams params) {
         super();
@@ -121,6 +145,8 @@ public class BHttpConnectionBase impleme
         this.connMetrics = createConnectionMetrics(
                 this.inTransportMetrics,
                 this.outTransportMetrics);
+        this.incomingContentStrategy = createIncomingContentStrategy();
+        this.outgoingContentStrategy = createOutgoingContentStrategy();
     }
 
     protected void assertNotOpen() {
@@ -167,6 +193,104 @@ public class BHttpConnectionBase impleme
         return new HttpConnectionMetricsImpl(inTransportMetric, outTransportMetric);
     }
 
+    protected ContentLengthStrategy createIncomingContentStrategy() {
+        return new LaxContentLengthStrategy();
+    }
+
+    protected ContentLengthStrategy createOutgoingContentStrategy() {
+        return new StrictContentLengthStrategy();
+    }
+
+    protected OutputStream getOutputStream() {
+        Asserts.check(this.outstream != null, "Output stream");
+        return this.outstream;
+    }
+
+    protected InputStream getInputStream() {
+        Asserts.check(this.instream != null, "Input stream");
+        return this.instream;
+    }
+
+    protected OutputStream createOutputStream(
+            final long len,
+            final SessionOutputBuffer outbuffer) {
+        if (len == ContentLengthStrategy.CHUNKED) {
+            return new ChunkedOutputStream(2048, outbuffer);
+        } else if (len == ContentLengthStrategy.IDENTITY) {
+            return new IdentityOutputStream(outbuffer);
+        } else {
+            return new ContentLengthOutputStream(outbuffer, len);
+        }
+    }
+
+    protected HttpEntity prepareOutputStream(final HttpMessage message) throws HttpException {
+        BasicHttpEntity entity = new BasicHttpEntity();
+        long len = this.outgoingContentStrategy.determineLength(message);
+        this.outstream = createOutputStream(len, this.outbuffer);
+        if (len == ContentLengthStrategy.CHUNKED) {
+            entity.setChunked(true);
+            entity.setContentLength(-1);
+        } else if (len == ContentLengthStrategy.IDENTITY) {
+            entity.setChunked(false);
+            entity.setContentLength(-1);
+        } else {
+            entity.setChunked(false);
+            entity.setContentLength(len);
+        }
+
+        Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
+        if (contentTypeHeader != null) {
+            entity.setContentType(contentTypeHeader);
+        }
+        Header contentEncodingHeader = message.getFirstHeader(HTTP.CONTENT_ENCODING);
+        if (contentEncodingHeader != null) {
+            entity.setContentEncoding(contentEncodingHeader);
+        }
+        return entity;
+    }
+
+    protected InputStream createInputStream(
+            final long len,
+            final SessionInputBuffer inbuffer) {
+        if (len == ContentLengthStrategy.CHUNKED) {
+            return new ChunkedInputStream(inbuffer);
+        } else if (len == ContentLengthStrategy.IDENTITY) {
+            return new IdentityInputStream(inbuffer);
+        } else {
+            return new ContentLengthInputStream(inbuffer, len);
+        }
+    }
+
+    protected HttpEntity prepareInputStream(final HttpMessage message) throws HttpException {
+        BasicHttpEntity entity = new BasicHttpEntity();
+
+        long len = this.incomingContentStrategy.determineLength(message);
+        this.instream = createInputStream(len, this.inbuffer);
+        if (len == ContentLengthStrategy.CHUNKED) {
+            entity.setChunked(true);
+            entity.setContentLength(-1);
+            entity.setContent(this.instream);
+        } else if (len == ContentLengthStrategy.IDENTITY) {
+            entity.setChunked(false);
+            entity.setContentLength(-1);
+            entity.setContent(this.instream);
+        } else {
+            entity.setChunked(false);
+            entity.setContentLength(len);
+            entity.setContent(this.instream);
+        }
+
+        Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
+        if (contentTypeHeader != null) {
+            entity.setContentType(contentTypeHeader);
+        }
+        Header contentEncodingHeader = message.getFirstHeader(HTTP.CONTENT_ENCODING);
+        if (contentEncodingHeader != null) {
+            entity.setContentEncoding(contentEncodingHeader);
+        }
+        return entity;
+    }
+
     public InetAddress getLocalAddress() {
         if (this.socket != null) {
             return this.socket.getLocalAddress();
@@ -286,18 +410,6 @@ public class BHttpConnectionBase impleme
         return this.connMetrics;
     }
 
-    private static void formatAddress(final StringBuilder buffer, final SocketAddress socketAddress) {
-        if (socketAddress instanceof InetSocketAddress) {
-            InetSocketAddress addr = ((InetSocketAddress) socketAddress);
-            buffer.append(addr.getAddress() != null ? addr.getAddress().getHostAddress() :
-                addr.getAddress())
-            .append(':')
-            .append(addr.getPort());
-        } else {
-            buffer.append(socketAddress);
-        }
-    }
-
     @Override
     public String toString() {
         if (this.socket != null) {
@@ -305,9 +417,9 @@ public class BHttpConnectionBase impleme
             SocketAddress remoteAddress = this.socket.getRemoteSocketAddress();
             SocketAddress localAddress = this.socket.getLocalSocketAddress();
             if (remoteAddress != null && localAddress != null) {
-                formatAddress(buffer, localAddress);
+                NetUtils.formatAddress(buffer, localAddress);
                 buffer.append("<->");
-                formatAddress(buffer, remoteAddress);
+                NetUtils.formatAddress(buffer, remoteAddress);
             }
             return buffer.toString();
         } else {

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntityDeserializer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntityDeserializer.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntityDeserializer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntityDeserializer.java Wed Sep 19 16:03:53 2012
@@ -36,6 +36,7 @@ import org.apache.http.HttpMessage;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.ContentLengthStrategy;
+import org.apache.http.impl.BHttpConnectionBase;
 import org.apache.http.impl.io.ChunkedInputStream;
 import org.apache.http.impl.io.ContentLengthInputStream;
 import org.apache.http.impl.io.IdentityInputStream;
@@ -58,8 +59,11 @@ import org.apache.http.util.Args;
  * transparently for the consumer.
  *
  * @since 4.0
+ * 
+ * @deprecated (4.3) use {@link BHttpConnectionBase}
  */
 @Immutable // assuming injected dependencies are immutable
+@Deprecated
 public class EntityDeserializer {
 
     private final ContentLengthStrategy lenStrategy;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntitySerializer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntitySerializer.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntitySerializer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/entity/EntitySerializer.java Wed Sep 19 16:03:53 2012
@@ -35,6 +35,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpMessage;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.entity.ContentLengthStrategy;
+import org.apache.http.impl.BHttpConnectionBase;
 import org.apache.http.impl.io.ChunkedOutputStream;
 import org.apache.http.impl.io.ContentLengthOutputStream;
 import org.apache.http.impl.io.IdentityOutputStream;
@@ -55,8 +56,11 @@ import org.apache.http.util.Args;
  * using a transfer coding based on properties on the HTTP message.
  *
  * @since 4.0
+ * 
+ * @deprecated (4.3) use {@link BHttpConnectionBase}
  */
 @Immutable // assuming injected dependencies are immutable
+@Deprecated
 public class EntitySerializer {
 
     private final ContentLengthStrategy lenStrategy;

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/ChunkedOutputStream.java Wed Sep 19 16:03:53 2012
@@ -60,19 +60,19 @@ public class ChunkedOutputStream extends
     /** True if the stream is closed. */
     private boolean closed = false;
 
-    // ----------------------------------------------------------- Constructors
     /**
      * Wraps a session output buffer and chunk-encodes the output.
      *
      * @param out The session output buffer
      * @param bufferSize The minimum chunk size (excluding last chunk)
-     * @throws IOException in case of an I/O error
+     * @throws IOException not thrown
+     * 
+     * @deprecated (4.3) use {@link ChunkedOutputStream#ChunkedOutputStream(int, SessionOutputBuffer)} 
      */
+    @Deprecated
     public ChunkedOutputStream(final SessionOutputBuffer out, int bufferSize)
             throws IOException {
-        super();
-        this.cache = new byte[bufferSize];
-        this.out = out;
+        this(bufferSize, out);
     }
 
     /**
@@ -80,14 +80,28 @@ public class ChunkedOutputStream extends
      * size of 2048 was chosen because the chunk overhead is less than 0.5%
      *
      * @param out       the output buffer to wrap
-     * @throws IOException in case of an I/O error
+     * @throws IOException not thrown
+     * 
+     * @deprecated (4.3) use {@link ChunkedOutputStream#ChunkedOutputStream(int, SessionOutputBuffer)} 
      */
+    @Deprecated
     public ChunkedOutputStream(final SessionOutputBuffer out)
             throws IOException {
-        this(out, 2048);
+        this(2048, out);
     }
 
-    // ----------------------------------------------------------- Internal methods
+    /**
+     * Wraps a session output buffer and chunk-encodes the output.
+     *
+     * @param bufferSize The minimum chunk size (excluding last chunk)
+     * @param out The session output buffer
+     */
+    public ChunkedOutputStream(int bufferSize, final SessionOutputBuffer out) {
+        super();
+        this.cache = new byte[bufferSize];
+        this.out = out;
+    }
+    
     /**
      * Writes the cache out onto the underlying stream
      */

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EncodingUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EncodingUtils.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EncodingUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/EncodingUtils.java Wed Sep 19 16:03:53 2012
@@ -107,7 +107,7 @@ public final class EncodingUtils {
         try {
             return data.getBytes(Consts.ASCII.name());
         } catch (UnsupportedEncodingException e) {
-            throw new Error("HttpClient requires ASCII support");
+            throw new Error("ASCII not supported");
         }
     }
 
@@ -126,7 +126,7 @@ public final class EncodingUtils {
         try {
             return new String(data, offset, length, Consts.ASCII.name());
         } catch (UnsupportedEncodingException e) {
-            throw new Error("HttpClient requires ASCII support");
+            throw new Error("ASCII not supported");
         }
     }
 

Added: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java?rev=1387655&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java (added)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java Wed Sep 19 16:03:53 2012
@@ -0,0 +1,54 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.util;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+
+/**
+ * @since 4.3
+ */
+public final class NetUtils {
+
+    public static void formatAddress(
+            final StringBuilder buffer,
+            final SocketAddress socketAddress) {
+        Args.notNull(buffer, "Buffer");
+        Args.notNull(socketAddress, "Socket address");
+        if (socketAddress instanceof InetSocketAddress) {
+            InetSocketAddress socketaddr = ((InetSocketAddress) socketAddress);
+            InetAddress inetaddr = socketaddr.getAddress();
+            buffer.append(inetaddr != null ? inetaddr.getHostAddress() : inetaddr)
+                .append(':').append(socketaddr.getPort());
+        } else {
+            buffer.append(socketAddress);
+        }
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/util/NetUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntityDeserializer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntityDeserializer.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntityDeserializer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntityDeserializer.java Wed Sep 19 16:03:53 2012
@@ -42,6 +42,7 @@ import org.apache.http.params.CoreProtoc
 import org.junit.Assert;
 import org.junit.Test;
 
+@Deprecated
 public class TestEntityDeserializer {
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntitySerializer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntitySerializer.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntitySerializer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/entity/TestEntitySerializer.java Wed Sep 19 16:03:53 2012
@@ -42,6 +42,7 @@ import org.apache.http.params.CoreProtoc
 import org.junit.Assert;
 import org.junit.Test;
 
+@Deprecated
 public class TestEntitySerializer {
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java?rev=1387655&r1=1387654&r2=1387655&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/impl/io/TestChunkCoding.java Wed Sep 19 16:03:53 2012
@@ -183,7 +183,7 @@ public class TestChunkCoding {
     @Test
     public void testChunkedOutputStreamClose() throws IOException {
         ChunkedOutputStream out = new ChunkedOutputStream(
-                new SessionOutputBufferMock());
+                2048, new SessionOutputBufferMock());
         out.close();
         out.close();
         try {
@@ -329,7 +329,7 @@ public class TestChunkCoding {
     public void testChunkedConsistence() throws IOException {
         String input = "76126;27823abcd;:q38a-\nkjc\rk%1ad\tkh/asdui\r\njkh+?\\suweb";
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        OutputStream out = new ChunkedOutputStream(new SessionOutputBufferMock(buffer));
+        OutputStream out = new ChunkedOutputStream(2048, new SessionOutputBufferMock(buffer));
         out.write(EncodingUtils.getBytes(input, CONTENT_CHARSET));
         out.flush();
         out.close();
@@ -353,7 +353,7 @@ public class TestChunkCoding {
     @Test
     public void testChunkedOutputStream() throws IOException {
         SessionOutputBufferMock buffer = new SessionOutputBufferMock();
-        ChunkedOutputStream out = new ChunkedOutputStream(buffer, 2);
+        ChunkedOutputStream out = new ChunkedOutputStream(2, buffer);
         out.write('1');
         out.write('2');
         out.write('3');
@@ -388,7 +388,7 @@ public class TestChunkCoding {
     @Test
     public void testChunkedOutputStreamLargeChunk() throws IOException {
         SessionOutputBufferMock buffer = new SessionOutputBufferMock();
-        ChunkedOutputStream out = new ChunkedOutputStream(buffer, 2);
+        ChunkedOutputStream out = new ChunkedOutputStream(2, buffer);
         out.write(new byte[] {'1', '2', '3', '4'});
         out.finish();
         out.close();
@@ -415,8 +415,7 @@ public class TestChunkCoding {
     @Test
     public void testChunkedOutputStreamSmallChunk() throws IOException {
         ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-        ChunkedOutputStream out = new ChunkedOutputStream(
-                new SessionOutputBufferMock(buffer), 2);
+        ChunkedOutputStream out = new ChunkedOutputStream(2, new SessionOutputBufferMock(buffer));
         out.write('1');
         out.finish();
         out.close();