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 2016/12/11 14:51:20 UTC
svn commit: r1773574 [2/2] - in /httpcomponents/httpcore/trunk:
httpcore5-testing/src/main/java/org/apache/hc/core5/testing/classic/
httpcore5/src/main/java/org/apache/hc/core5/http/config/
httpcore5/src/main/java/org/apache/hc/core5/http/impl/io/ http...
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestChunkCoding.java Sun Dec 11 14:51:19 2016
@@ -35,17 +35,16 @@ import java.nio.charset.StandardCharsets
import java.util.Arrays;
import java.util.List;
+import org.apache.hc.core5.function.Supplier;
import org.apache.hc.core5.http.ConnectionClosedException;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.MalformedChunkCodingException;
import org.apache.hc.core5.http.MessageConstraintException;
import org.apache.hc.core5.http.StreamClosedException;
import org.apache.hc.core5.http.TruncatedChunkException;
-import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.io.SessionInputBuffer;
import org.apache.hc.core5.http.io.SessionOutputBuffer;
import org.apache.hc.core5.http.message.BasicHeader;
-import org.apache.hc.core5.function.Supplier;
import org.junit.Assert;
import org.junit.Test;
@@ -302,14 +301,14 @@ public class TestChunkCoding {
@Test
public void testTooLongChunkHeader() throws IOException {
final String s = "5; and some very looooong commend\r\n12345\r\n0\r\n";
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16, H1Config.DEFAULT);
+ final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(16);
final ByteArrayInputStream inputStream1 = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
final ChunkedInputStream in1 = new ChunkedInputStream(inbuffer1, inputStream1);
final byte[] buffer = new byte[300];
Assert.assertEquals(5, in1.read(buffer));
in1.close();
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16, H1Config.custom().setMaxLineLength(10).build());
+ final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(16, 10);
final ByteArrayInputStream inputStream2 = new ByteArrayInputStream(s.getBytes(StandardCharsets.ISO_8859_1));
final ChunkedInputStream in2 = new ChunkedInputStream(inbuffer2, inputStream2);
try {
@@ -328,7 +327,7 @@ public class TestChunkCoding {
public void testChunkedOutputStreamClose() throws IOException {
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final ChunkedOutputStream out = new ChunkedOutputStream(2048, outbuffer, outputStream);
+ final ChunkedOutputStream out = new ChunkedOutputStream(outbuffer, outputStream, 2048);
out.close();
out.close();
try {
@@ -350,7 +349,7 @@ public class TestChunkCoding {
final String input = "76126;27823abcd;:q38a-\nkjc\rk%1ad\tkh/asdui\r\njkh+?\\suweb";
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final ChunkedOutputStream out = new ChunkedOutputStream(2048, outbuffer, outputStream);
+ final ChunkedOutputStream out = new ChunkedOutputStream(outbuffer, outputStream, 2048);
out.write(input.getBytes(StandardCharsets.ISO_8859_1));
out.flush();
out.close();
@@ -375,7 +374,7 @@ public class TestChunkCoding {
public void testChunkedOutputStreamWithTrailers() throws IOException {
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final ChunkedOutputStream out = new ChunkedOutputStream(2, outbuffer, outputStream, new Supplier<List<? extends Header>>() {
+ final ChunkedOutputStream out = new ChunkedOutputStream(outbuffer, outputStream, 2, new Supplier<List<? extends Header>>() {
@Override
public List<? extends Header> get() {
return Arrays.asList(
@@ -396,7 +395,7 @@ public class TestChunkCoding {
public void testChunkedOutputStream() throws IOException {
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final ChunkedOutputStream out = new ChunkedOutputStream(2, outbuffer, outputStream);
+ final ChunkedOutputStream out = new ChunkedOutputStream(outbuffer, outputStream, 2);
out.write('1');
out.write('2');
out.write('3');
@@ -412,7 +411,7 @@ public class TestChunkCoding {
public void testChunkedOutputStreamLargeChunk() throws IOException {
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final ChunkedOutputStream out = new ChunkedOutputStream(2, outbuffer, outputStream);
+ final ChunkedOutputStream out = new ChunkedOutputStream(outbuffer, outputStream, 2);
out.write(new byte[] {'1', '2', '3', '4'});
out.finish();
out.close();
@@ -425,7 +424,7 @@ public class TestChunkCoding {
public void testChunkedOutputStreamSmallChunk() throws IOException {
final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- final ChunkedOutputStream out = new ChunkedOutputStream(2, outbuffer, outputStream);
+ final ChunkedOutputStream out = new ChunkedOutputStream(outbuffer, outputStream, 2);
out.write('1');
out.finish();
out.close();
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java Sun Dec 11 14:51:19 2016
@@ -32,16 +32,16 @@ import java.io.InputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
-import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.LengthRequiredException;
import org.apache.hc.core5.http.NotImplementedException;
import org.apache.hc.core5.http.config.H1Config;
+import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
import org.apache.hc.core5.http.io.entity.ByteArrayEntity;
-import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.io.entity.StringEntity;
-import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
import org.junit.Assert;
import org.junit.Before;
@@ -60,7 +60,7 @@ public class TestDefaultBHttpClientConne
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- conn = new DefaultBHttpClientConnection(1024, 1024,
+ conn = new DefaultBHttpClientConnection(1024,
null, null,
H1Config.DEFAULT,
DefaultContentLengthStrategy.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java Sun Dec 11 14:51:19 2016
@@ -32,15 +32,15 @@ import java.io.InputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
-import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ContentType;
+import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.NotImplementedException;
import org.apache.hc.core5.http.ProtocolException;
import org.apache.hc.core5.http.config.H1Config;
-import org.apache.hc.core5.http.ContentType;
-import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.impl.DefaultContentLengthStrategy;
+import org.apache.hc.core5.http.io.entity.StringEntity;
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
import org.junit.Assert;
import org.junit.Before;
@@ -59,7 +59,7 @@ public class TestDefaultBHttpServerConne
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- conn = new DefaultBHttpServerConnection(1024, 1024,
+ conn = new DefaultBHttpServerConnection(1024,
null, null,
H1Config.DEFAULT,
DefaultContentLengthStrategy.INSTANCE,
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java Sun Dec 11 14:51:19 2016
@@ -37,7 +37,6 @@ import java.nio.charset.CodingErrorActio
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http.MessageConstraintException;
-import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.io.HttpTransportMetrics;
import org.apache.hc.core5.http.io.SessionInputBuffer;
@@ -398,7 +397,7 @@ public class TestSessionInOutBuffers {
final String s = "a very looooooooooooooooooooooooooooooooooooooooooong line\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
// no limit
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(5, H1Config.DEFAULT);
+ final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(5);
final InputStream inputStream1 = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
inbuffer1.readLine(chbuffer, inputStream1);
@@ -406,9 +405,7 @@ public class TestSessionInOutBuffers {
Assert.assertEquals(60, bytesRead);
// 15 char limit
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(5, H1Config.custom()
- .setMaxLineLength(15)
- .build());
+ final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(5, 15);
final InputStream inputStream2 = new ByteArrayInputStream(tmp);
try {
chbuffer.clear();
@@ -423,7 +420,7 @@ public class TestSessionInOutBuffers {
final String s = "just a line\r\n";
final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
// no limit
- final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(25, H1Config.DEFAULT);
+ final SessionInputBuffer inbuffer1 = new SessionInputBufferImpl(25);
final InputStream inputStream1 = new ByteArrayInputStream(tmp);
final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
inbuffer1.readLine(chbuffer, inputStream1);
@@ -431,9 +428,7 @@ public class TestSessionInOutBuffers {
Assert.assertEquals(13, bytesRead);
// 10 char limit
- final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(25, H1Config.custom()
- .setMaxLineLength(10)
- .build());
+ final SessionInputBuffer inbuffer2 = new SessionInputBufferImpl(25, 10);
final InputStream inputStream2 = new ByteArrayInputStream(tmp);
try {
chbuffer.clear();
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java Sun Dec 11 14:51:19 2016
@@ -55,7 +55,7 @@ public class TestChunkDecoder {
final String s = "5\r\n01234\r\n5\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n";
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -81,7 +81,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -118,7 +118,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s1, s2}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -154,7 +154,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(32, 32, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(32, 32, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -184,7 +184,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
chunks, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ByteBuffer dst = ByteBuffer.allocate(1024);
@@ -221,7 +221,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -235,7 +235,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -249,7 +249,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -265,7 +265,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -288,7 +288,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -303,7 +303,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -321,7 +321,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -351,7 +351,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -383,7 +383,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
@@ -423,8 +423,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
- H1Config.custom().setMaxLineLength(10).build());
+ final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256, 10);
final BasicHttpTransportMetrics metrics2 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, metrics2);
@@ -444,8 +443,7 @@ public class TestChunkDecoder {
// "0\r\nFooter1: looooooooooooooooooooooooooooooooooooooooog\r\n \r\n fghij\r\n\r\n";
final ReadableByteChannel channel1 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256, 0);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -461,7 +459,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
- H1Config.custom().setMaxLineLength(25).build(), StandardCharsets.US_ASCII);
+ 25, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics2 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, metrics2);
@@ -480,7 +478,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel1 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -493,15 +491,14 @@ public class TestChunkDecoder {
Assert.assertNotNull(trailers);
Assert.assertEquals(1, trailers.size());
- final H1Config constraints = H1Config.custom()
+ final H1Config h1Config = H1Config.custom()
.setMaxLineLength(25)
.build();
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
- constraints, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics2 = new BasicHttpTransportMetrics();
- final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, constraints, metrics2);
+ final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, h1Config, metrics2);
dst.clear();
try {
@@ -517,8 +514,7 @@ public class TestChunkDecoder {
"0\r\nFooter1: blah\r\nFooter2: blah\r\nFooter3: blah\r\nFooter4: blah\r\n\r\n";
final ReadableByteChannel channel1 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
- H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics1 = new BasicHttpTransportMetrics();
final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
@@ -531,14 +527,14 @@ public class TestChunkDecoder {
Assert.assertNotNull(trailers);
Assert.assertEquals(4, trailers.size());
- final H1Config constraints = H1Config.custom()
+ final H1Config h1Config = H1Config.custom()
.setMaxHeaderCount(3).build();
final ReadableByteChannel channel2 = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
- constraints, StandardCharsets.US_ASCII);
+ 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics2 = new BasicHttpTransportMetrics();
- final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, constraints, metrics2);
+ final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, h1Config, metrics2);
dst.clear();
try {
@@ -553,7 +549,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
try {
new ChunkDecoder(null, null, null);
Assert.fail("IllegalArgumentException should have been thrown");
@@ -581,7 +577,7 @@ public class TestChunkDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
decoder.read(null);
@@ -591,7 +587,7 @@ public class TestChunkDecoder {
public void testHugeChunk() throws Exception {
final String s = "1234567890abcdef\r\n0123456789abcdef";
final ReadableByteChannel channel = new ReadableByteChannelMock(new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java Sun Dec 11 14:51:19 2016
@@ -36,7 +36,6 @@ import java.nio.channels.ReadableByteCha
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http.ReadableByteChannelMock;
-import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.junit.After;
@@ -67,7 +66,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
@@ -106,7 +105,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
inbuf.fill(channel);
@@ -149,7 +148,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final IdentityDecoder decoder = new IdentityDecoder(
channel, inbuf, metrics);
@@ -179,7 +178,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final IdentityDecoder decoder = new IdentityDecoder(
channel, inbuf, metrics);
@@ -213,7 +212,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final IdentityDecoder decoder = new IdentityDecoder(
channel, inbuf, metrics);
@@ -260,7 +259,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"a"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final IdentityDecoder decoder = new IdentityDecoder(
channel, inbuf, metrics);
@@ -284,7 +283,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
try {
new IdentityDecoder(null, null, null);
Assert.fail("IllegalArgumentException should have been thrown");
@@ -311,7 +310,7 @@ public class TestIdentityDecoder {
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestLengthDelimitedDecoder.java Sun Dec 11 14:51:19 2016
@@ -37,7 +37,6 @@ import java.nio.charset.StandardCharsets
import org.apache.hc.core5.http.ConnectionClosedException;
import org.apache.hc.core5.http.ReadableByteChannelMock;
-import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.impl.BasicHttpTransportMetrics;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.junit.After;
@@ -68,7 +67,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 16);
@@ -104,7 +103,7 @@ public class TestLengthDelimitedDecoder
"stuff;",
"more stuff; and a lot more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 16);
@@ -136,7 +135,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 16);
@@ -189,7 +188,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
inbuf.fill(channel);
@@ -228,7 +227,7 @@ public class TestLengthDelimitedDecoder
"stuff;",
"more stuff; and a lot more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
inbuf.fill(channel);
@@ -260,7 +259,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 36);
@@ -289,7 +288,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff; ", "more stuff; ", "a lot more stuff!!!"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 36);
@@ -321,7 +320,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 36);
@@ -368,7 +367,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"a"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 1);
@@ -395,7 +394,7 @@ public class TestLengthDelimitedDecoder
"stuff;",
"more stuff; and a lot more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 16);
@@ -429,7 +428,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
try {
new LengthDelimitedDecoder(null, null, null, 10);
@@ -463,7 +462,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {s}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 3);
@@ -481,7 +480,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"stuff"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 0);
@@ -499,7 +498,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"1234567890"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 20);
@@ -516,7 +515,7 @@ public class TestLengthDelimitedDecoder
final ReadableByteChannel channel = new ReadableByteChannelMock(
new String[] {"1234567890"}, StandardCharsets.US_ASCII);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, H1Config.DEFAULT, StandardCharsets.US_ASCII);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, 0, StandardCharsets.US_ASCII);
final BasicHttpTransportMetrics metrics = new BasicHttpTransportMetrics();
final LengthDelimitedDecoder decoder = new LengthDelimitedDecoder(
channel, inbuf, metrics, 20);
Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java?rev=1773574&r1=1773573&r2=1773574&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestSessionInOutBuffers.java Sun Dec 11 14:51:19 2016
@@ -42,7 +42,6 @@ import java.nio.charset.CodingErrorActio
import java.nio.charset.StandardCharsets;
import org.apache.hc.core5.http.MessageConstraintException;
-import org.apache.hc.core5.http.config.H1Config;
import org.apache.hc.core5.http.nio.SessionInputBuffer;
import org.apache.hc.core5.http.nio.SessionOutputBuffer;
import org.apache.hc.core5.util.CharArrayBuffer;
@@ -121,8 +120,7 @@ public class TestSessionInOutBuffers {
Assert.assertTrue(inbuf1.readLine(line, false));
line.clear();
- final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(128, 128,
- H1Config.custom().setMaxLineLength(10).build());
+ final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(128, 128, 10);
final ReadableByteChannel channel2 = newChannel(s);
inbuf2.fill(channel2);
try {
@@ -143,8 +141,7 @@ public class TestSessionInOutBuffers {
Assert.assertFalse(inbuf1.readLine(line, false));
line.clear();
- final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(32, 32,
- H1Config.custom().setMaxLineLength(10).build());
+ final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(32, 32,10);
final ReadableByteChannel channel2 = newChannel(s);
inbuf2.fill(channel2);
try {
@@ -157,7 +154,7 @@ public class TestSessionInOutBuffers {
@Test
public void testWriteLineChunks() throws Exception {
final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(16, 16);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0);
ReadableByteChannel inChannel = newChannel("One\r\nTwo\r\nThree");
@@ -240,7 +237,7 @@ public class TestSessionInOutBuffers {
final ReadableByteChannel channel = newChannel(outstream.toByteArray());
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, 0);
inbuf.fill(channel);
for (final String teststr : teststrs) {
@@ -294,7 +291,7 @@ public class TestSessionInOutBuffers {
final ReadableByteChannel channel = newChannel(outstream.toByteArray());
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 16, 0);
inbuf.fill(channel);
final CharArrayBuffer chbuffer = new CharArrayBuffer(32);
@@ -338,7 +335,7 @@ public class TestSessionInOutBuffers {
out[i] = (byte)('0' + i);
}
final ReadableByteChannel channel = newChannel(out);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0);
while (inbuf.fill(channel) > 0) {
}
@@ -355,7 +352,7 @@ public class TestSessionInOutBuffers {
public void testReadByteBuffer() throws Exception {
final byte[] pattern = "0123456789ABCDEF".getBytes(StandardCharsets.US_ASCII);
final ReadableByteChannel channel = newChannel(pattern);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, 0);
while (inbuf.fill(channel) > 0) {
}
final ByteBuffer dst = ByteBuffer.allocate(10);
@@ -372,7 +369,7 @@ public class TestSessionInOutBuffers {
public void testReadByteBufferWithMaxLen() throws Exception {
final byte[] pattern = "0123456789ABCDEF".getBytes(StandardCharsets.US_ASCII);
final ReadableByteChannel channel = newChannel(pattern);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, 0);
while (inbuf.fill(channel) > 0) {
}
final ByteBuffer dst = ByteBuffer.allocate(16);
@@ -392,7 +389,7 @@ public class TestSessionInOutBuffers {
public void testReadToChannel() throws Exception {
final byte[] pattern = "0123456789ABCDEF".getBytes(StandardCharsets.US_ASCII);
final ReadableByteChannel channel = newChannel(pattern);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, 0);
while (inbuf.fill(channel) > 0) {
}
@@ -407,7 +404,7 @@ public class TestSessionInOutBuffers {
public void testReadToChannelWithMaxLen() throws Exception {
final byte[] pattern = "0123456789ABCDEF".getBytes(StandardCharsets.US_ASCII);
final ReadableByteChannel channel = newChannel(pattern);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, null);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(4096, 1024, 0);
while (inbuf.fill(channel) > 0) {
}
@@ -499,7 +496,7 @@ public class TestSessionInOutBuffers {
final byte[] tmp = outstream.toByteArray();
final ReadableByteChannel channel = newChannel(tmp);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, H1Config.DEFAULT,
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0,
StandardCharsets.UTF_8.newDecoder());
while (inbuf.fill(channel) > 0) {
@@ -535,7 +532,7 @@ public class TestSessionInOutBuffers {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPORT);
decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, H1Config.DEFAULT, decoder);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0, decoder);
final ReadableByteChannel channel = newChannel(tmp);
while (inbuf.fill(channel) > 0) {
}
@@ -551,7 +548,7 @@ public class TestSessionInOutBuffers {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
decoder.onMalformedInput(CodingErrorAction.IGNORE);
decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, H1Config.DEFAULT, decoder);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0, decoder);
final ReadableByteChannel channel = newChannel(tmp);
while (inbuf.fill(channel) > 0) {
}
@@ -568,7 +565,7 @@ public class TestSessionInOutBuffers {
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
- final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, H1Config.DEFAULT, decoder);
+ final SessionInputBuffer inbuf = new SessionInputBufferImpl(16, 16, 0, decoder);
final ReadableByteChannel channel = newChannel(tmp);
while (inbuf.fill(channel) > 0) {
}