hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1716559 [2/3] - in /httpcomponents/httpcore/trunk: httpcore-ab/src/main/java/org/apache/hc/core5/http/benchmark/ httpcore/src/main/java/org/apache/hc/core5/http/ httpcore/src/main/java/org/apache/hc/core5/http/config/ httpcore/src/main/jav...
Date Thu, 26 Nov 2015 03:47:24 GMT
Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/io/TestSessionInOutBuffers.java Thu Nov 26 03:47:23 2015
@@ -32,8 +32,8 @@ import java.nio.charset.CharacterCodingE
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.MessageConstraintException;
 import org.apache.hc.core5.http.config.MessageConstraints;
 import org.apache.hc.core5.http.io.HttpTransportMetrics;
@@ -138,7 +138,7 @@ public class TestSessionInOutBuffers {
         }
         final String s1 = buffer.toString();
         buffer.append("\r\n");
-        outbuffer.write(buffer.toString().getBytes(Consts.ASCII));
+        outbuffer.write(buffer.toString().getBytes(StandardCharsets.US_ASCII));
         outbuffer.flush();
         bytesWritten = outbuffer.getMetrics().getBytesTransferred();
         Assert.assertEquals(8 + 14 +2, bytesWritten);
@@ -149,7 +149,7 @@ public class TestSessionInOutBuffers {
         }
         final String s2 = buffer.toString();
         buffer.append("\r\n");
-        outbuffer.write(buffer.toString().getBytes(Consts.ASCII));
+        outbuffer.write(buffer.toString().getBytes(StandardCharsets.US_ASCII));
         outbuffer.flush();
         bytesWritten = outbuffer.getMetrics().getBytesTransferred();
         Assert.assertEquals(8 + 14 + 2 + 15 + 2 , bytesWritten);
@@ -160,7 +160,7 @@ public class TestSessionInOutBuffers {
         }
         final String s3 = buffer.toString();
         buffer.append("\r\n");
-        outbuffer.write(buffer.toString().getBytes(Consts.ASCII));
+        outbuffer.write(buffer.toString().getBytes(StandardCharsets.US_ASCII));
         outbuffer.flush();
         bytesWritten = outbuffer.getMetrics().getBytesTransferred();
         Assert.assertEquals(8 + 14 + 2 + 15 + 2 + 16 + 2, bytesWritten);
@@ -383,7 +383,7 @@ public class TestSessionInOutBuffers {
     @Test
     public void testLineLimit() throws Exception {
         final String s = "a very looooooooooooooooooooooooooooooooooooooooooong line\r\n";
-        final byte[] tmp = s.getBytes(Consts.ASCII);
+        final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
         // no limit
         final SessionInputBufferMock inbuffer1 = new SessionInputBufferMock(tmp, 5,
                 MessageConstraints.DEFAULT);
@@ -406,7 +406,7 @@ public class TestSessionInOutBuffers {
     @Test
     public void testLineLimit2() throws Exception {
         final String s = "just a line\r\n";
-        final byte[] tmp = s.getBytes(Consts.ASCII);
+        final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
         // no limit
         final SessionInputBufferMock inbuffer1 = new SessionInputBufferMock(tmp, 25,
                 MessageConstraints.DEFAULT);
@@ -429,7 +429,7 @@ public class TestSessionInOutBuffers {
     @Test
     public void testReadLineFringeCase1() throws Exception {
         final String s = "abc\r\n";
-        final byte[] tmp = s.getBytes(Consts.ASCII);
+        final byte[] tmp = s.getBytes(StandardCharsets.US_ASCII);
         final SessionInputBufferMock inbuffer1 = new SessionInputBufferMock(tmp, 128);
         Assert.assertEquals('a', inbuffer1.read());
         Assert.assertEquals('b', inbuffer1.read());
@@ -464,7 +464,7 @@ public class TestSessionInOutBuffers {
         final String s2 = constructString(RUSSIAN_HELLO);
         final String s3 = "Like hello and stuff";
 
-        final SessionOutputBufferMock outbuffer = new SessionOutputBufferMock(Consts.UTF_8);
+        final SessionOutputBufferMock outbuffer = new SessionOutputBufferMock(StandardCharsets.UTF_8);
 
         final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
         for (int i = 0; i < 10; i++) {
@@ -480,13 +480,13 @@ public class TestSessionInOutBuffers {
         }
         outbuffer.flush();
         final long bytesWritten = outbuffer.getMetrics().getBytesTransferred();
-        final long expected = ((s1.getBytes(Consts.UTF_8).length + 2)+
-                (s2.getBytes(Consts.UTF_8).length + 2) +
-                (s3.getBytes(Consts.UTF_8).length + 2)) * 10;
+        final long expected = ((s1.getBytes(StandardCharsets.UTF_8).length + 2)+
+                (s2.getBytes(StandardCharsets.UTF_8).length + 2) +
+                (s3.getBytes(StandardCharsets.UTF_8).length + 2)) * 10;
         Assert.assertEquals(expected, bytesWritten);
 
         final SessionInputBufferMock inbuffer = new SessionInputBufferMock(
-                outbuffer.getData(), Consts.UTF_8);
+                outbuffer.getData(), StandardCharsets.UTF_8);
 
         for (int i = 0; i < 10; i++) {
             chbuffer.clear();
@@ -518,7 +518,7 @@ public class TestSessionInOutBuffers {
         }
         final String s = buf.toString();
 
-        final SessionOutputBufferMock outbuffer = new SessionOutputBufferMock(Consts.UTF_8);
+        final SessionOutputBufferMock outbuffer = new SessionOutputBufferMock(StandardCharsets.UTF_8);
 
         final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
         chbuffer.append(s);
@@ -526,7 +526,7 @@ public class TestSessionInOutBuffers {
         outbuffer.flush();
 
         final SessionInputBufferMock inbuffer = new SessionInputBufferMock(
-                outbuffer.getData(), Consts.UTF_8);
+                outbuffer.getData(), StandardCharsets.UTF_8);
 
         chbuffer.clear();
         inbuffer.readLine(chbuffer);
@@ -537,7 +537,7 @@ public class TestSessionInOutBuffers {
     public void testNonAsciiReadWriteLine() throws Exception {
         final String s1 = constructString(SWISS_GERMAN_HELLO);
 
-        final SessionOutputBufferMock outbuffer = new SessionOutputBufferMock(Consts.ISO_8859_1);
+        final SessionOutputBufferMock outbuffer = new SessionOutputBufferMock(StandardCharsets.ISO_8859_1);
 
         final CharArrayBuffer chbuffer = new CharArrayBuffer(16);
         for (int i = 0; i < 10; i++) {
@@ -549,11 +549,11 @@ public class TestSessionInOutBuffers {
         outbuffer.writeLine(chbuffer);
         outbuffer.flush();
         final long bytesWritten = outbuffer.getMetrics().getBytesTransferred();
-        final long expected = ((s1.getBytes(Consts.ISO_8859_1).length + 2)) * 10 + 2;
+        final long expected = ((s1.getBytes(StandardCharsets.ISO_8859_1).length + 2)) * 10 + 2;
         Assert.assertEquals(expected, bytesWritten);
 
         final SessionInputBufferMock inbuffer = new SessionInputBufferMock(
-                outbuffer.getData(), Consts.ISO_8859_1);
+                outbuffer.getData(), StandardCharsets.ISO_8859_1);
 
         for (int i = 0; i < 10; i++) {
             chbuffer.clear();
@@ -574,7 +574,7 @@ public class TestSessionInOutBuffers {
     @Test(expected=CharacterCodingException.class)
     public void testUnmappableInputActionReport() throws Exception {
         final String s = "This text contains a circumflex \u0302 !!!";
-        final CharsetEncoder encoder = Consts.ISO_8859_1.newEncoder();
+        final CharsetEncoder encoder = StandardCharsets.ISO_8859_1.newEncoder();
         encoder.onMalformedInput(CodingErrorAction.IGNORE);
         encoder.onUnmappableCharacter(CodingErrorAction.REPORT);
         final SessionOutputBufferMock outbuf = new SessionOutputBufferMock(encoder);
@@ -586,7 +586,7 @@ public class TestSessionInOutBuffers {
     @Test
     public void testUnmappableInputActionReplace() throws Exception {
         final String s = "This text contains a circumflex \u0302 !!!";
-        final CharsetEncoder encoder = Consts.ISO_8859_1.newEncoder();
+        final CharsetEncoder encoder = StandardCharsets.ISO_8859_1.newEncoder();
         encoder.onMalformedInput(CodingErrorAction.IGNORE);
         encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
         final SessionOutputBufferMock outbuf = new SessionOutputBufferMock(encoder);
@@ -601,7 +601,7 @@ public class TestSessionInOutBuffers {
     @Test
     public void testUnmappableInputActionIgnore() throws Exception {
         final String s = "This text contains a circumflex \u0302 !!!";
-        final CharsetEncoder encoder = Consts.ISO_8859_1.newEncoder();
+        final CharsetEncoder encoder = StandardCharsets.ISO_8859_1.newEncoder();
         encoder.onMalformedInput(CodingErrorAction.IGNORE);
         encoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
         final SessionOutputBufferMock outbuf = new SessionOutputBufferMock(encoder);
@@ -615,8 +615,8 @@ public class TestSessionInOutBuffers {
 
     @Test(expected=CharacterCodingException.class)
     public void testMalformedInputActionReport() throws Exception {
-        final byte[] tmp = constructString(SWISS_GERMAN_HELLO).getBytes(Consts.ISO_8859_1);
-        final CharsetDecoder decoder = Consts.UTF_8.newDecoder();
+        final byte[] tmp = constructString(SWISS_GERMAN_HELLO).getBytes(StandardCharsets.ISO_8859_1);
+        final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
         decoder.onMalformedInput(CodingErrorAction.REPORT);
         decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
         final SessionInputBufferMock inbuffer = new SessionInputBufferMock(tmp, decoder);
@@ -626,8 +626,8 @@ public class TestSessionInOutBuffers {
 
     @Test
     public void testMalformedInputActionReplace() throws Exception {
-        final byte[] tmp = constructString(SWISS_GERMAN_HELLO).getBytes(Consts.ISO_8859_1);
-        final CharsetDecoder decoder = Consts.UTF_8.newDecoder();
+        final byte[] tmp = constructString(SWISS_GERMAN_HELLO).getBytes(StandardCharsets.ISO_8859_1);
+        final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
         decoder.onMalformedInput(CodingErrorAction.REPLACE);
         decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
         final SessionInputBufferMock inbuffer = new SessionInputBufferMock(tmp, decoder);
@@ -638,8 +638,8 @@ public class TestSessionInOutBuffers {
 
     @Test
     public void testMalformedInputActionIgnore() throws Exception {
-        final byte[] tmp = constructString(SWISS_GERMAN_HELLO).getBytes(Consts.ISO_8859_1);
-        final CharsetDecoder decoder = Consts.UTF_8.newDecoder();
+        final byte[] tmp = constructString(SWISS_GERMAN_HELLO).getBytes(StandardCharsets.ISO_8859_1);
+        final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
         decoder.onMalformedInput(CodingErrorAction.IGNORE);
         decoder.onUnmappableCharacter(CodingErrorAction.IGNORE);
         final SessionInputBufferMock inbuffer = new SessionInputBufferMock(tmp, decoder);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/CodecTestUtils.java Thu Nov 26 03:47:23 2015
@@ -31,13 +31,12 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
-
-import org.apache.hc.core5.http.Consts;
+import java.nio.charset.StandardCharsets;
 
 class CodecTestUtils {
 
     public static ByteBuffer wrap(final String s) {
-        return ByteBuffer.wrap(s.getBytes(Consts.ASCII));
+        return ByteBuffer.wrap(s.getBytes(StandardCharsets.US_ASCII));
     }
 
     public static String convert(final ByteBuffer src) {

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestBuffers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestBuffers.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestBuffers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestBuffers.java Thu Nov 26 03:47:23 2015
@@ -33,8 +33,8 @@ import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.channels.WritableByteChannel;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.impl.io.HttpTransportMetricsImpl;
 import org.apache.hc.core5.http.nio.ContentDecoder;
 import org.apache.hc.core5.http.nio.ContentEncoder;
@@ -52,7 +52,7 @@ public class TestBuffers {
     @Test
     public void testInputBufferOperations() throws IOException {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff;", "more stuff"}, Consts.ASCII);
+                new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
 
         final ContentDecoder decoder = new ContentDecoderMock(channel);
 
@@ -64,7 +64,7 @@ public class TestBuffers {
         final byte[] b1 = new byte[5];
 
         int len = buffer.read(b1);
-        Assert.assertEquals("stuff", new String(b1, 0, len, Consts.ASCII));
+        Assert.assertEquals("stuff", new String(b1, 0, len, StandardCharsets.US_ASCII));
 
         final int c = buffer.read();
         Assert.assertEquals(';', c);
@@ -72,7 +72,7 @@ public class TestBuffers {
         final byte[] b2 = new byte[1024];
 
         len = buffer.read(b2);
-        Assert.assertEquals("more stuff", new String(b2, 0, len, Consts.ASCII));
+        Assert.assertEquals("more stuff", new String(b2, 0, len, StandardCharsets.US_ASCII));
 
         Assert.assertEquals(-1, buffer.read());
         Assert.assertEquals(-1, buffer.read(b2));
@@ -87,23 +87,23 @@ public class TestBuffers {
     public void testOutputBufferOperations() throws IOException {
         final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
         final WritableByteChannel channel = Channels.newChannel(outstream);
-        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionOutputBuffer outbuf = new SessionOutputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
 
         final ContentEncoder encoder = new ContentEncoderMock(channel, outbuf, metrics);
 
         final SimpleOutputBuffer buffer = new SimpleOutputBuffer(4, DirectByteBufferAllocator.INSTANCE);
 
-        buffer.write("stuff".getBytes(Consts.ASCII));
+        buffer.write("stuff".getBytes(StandardCharsets.US_ASCII));
         buffer.write(';');
         buffer.produceContent(encoder);
 
-        buffer.write("more ".getBytes(Consts.ASCII));
-        buffer.write("stuff".getBytes(Consts.ASCII));
+        buffer.write("more ".getBytes(StandardCharsets.US_ASCII));
+        buffer.write("stuff".getBytes(StandardCharsets.US_ASCII));
         buffer.produceContent(encoder);
 
         final byte[] content = outstream.toByteArray();
-        Assert.assertEquals("stuff;more stuff", new String(content, Consts.ASCII));
+        Assert.assertEquals("stuff;more stuff", new String(content, StandardCharsets.US_ASCII));
     }
 
     @Test

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java Thu Nov 26 03:47:23 2015
@@ -30,9 +30,9 @@ package org.apache.hc.core5.http.impl.ni
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.hc.core5.http.ConnectionClosedException;
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.MalformedChunkCodingException;
 import org.apache.hc.core5.http.MessageConstraintException;
@@ -52,8 +52,8 @@ public class TestChunkDecoder {
     public void testBasicDecoding() throws Exception {
         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}, Consts.ASCII);
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -77,9 +77,9 @@ public class TestChunkDecoder {
         final 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";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -114,9 +114,9 @@ public class TestChunkDecoder {
         final String s1 = "5\r\n01234\r\n5\r\n5678";
         final String s2 = "9\r\n6\r\nabcdef\r\n0\r\n\r\n";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s1, s2}, Consts.ASCII);
+                new String[] {s1, s2}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -150,9 +150,9 @@ public class TestChunkDecoder {
                 "-----------------------------------------------------------------------------" +
                 "-----------------------------------------------------------------------------";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(32, 32, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(32, 32, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -180,9 +180,9 @@ public class TestChunkDecoder {
                 "ghij\r\n\r\n"
         };
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                chunks, Consts.ASCII);
+                chunks, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ByteBuffer dst = ByteBuffer.allocate(1024);
 
@@ -217,9 +217,9 @@ public class TestChunkDecoder {
     public void testMalformedChunkSizeDecoding() throws Exception {
         final String s = "5\r\n01234\r\n5zz\r\n56789\r\n6\r\nabcdef\r\n0\r\n\r\n";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -231,9 +231,9 @@ public class TestChunkDecoder {
     public void testMalformedChunkEndingDecoding() throws Exception {
         final String s = "5\r\n01234\r\n5\r\n56789\r\r6\r\nabcdef\r\n0\r\n\r\n";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -245,9 +245,9 @@ public class TestChunkDecoder {
     public void testMalformedChunkTruncatedChunk() throws Exception {
         final String s = "3\r\n12";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -261,9 +261,9 @@ public class TestChunkDecoder {
         final 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";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -284,9 +284,9 @@ public class TestChunkDecoder {
         final 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";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -299,9 +299,9 @@ public class TestChunkDecoder {
         final String s = "10\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -317,9 +317,9 @@ public class TestChunkDecoder {
         final String s = "10\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -347,9 +347,9 @@ public class TestChunkDecoder {
                 "40\r\n12345678901234561234567890123456" +
                 "12345678901234561234567890123456\r\n0\r\n";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -379,9 +379,9 @@ public class TestChunkDecoder {
         final String s = "10\r\n1234567890123456\r\n" +
                 "5\r\n12345\r\n5\r\n12345\r\n0\r\n";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
 
@@ -404,7 +404,7 @@ public class TestChunkDecoder {
     public void testTooLongChunkHeader() throws Exception {
         final String s = "5; and some very looooong comment\r\n12345\r\n0\r\n";
         final ReadableByteChannel channel1 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
         final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
                 MessageConstraints.DEFAULT, null, null);
@@ -420,7 +420,7 @@ public class TestChunkDecoder {
         Assert.assertTrue(decoder1.isCompleted());
 
         final ReadableByteChannel channel2 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
         final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
                 MessageConstraints.lineLen(10), null, null);
@@ -442,9 +442,9 @@ public class TestChunkDecoder {
 //        final String s = "10\r\n1234567890123456\r\n" +
 //                "0\r\nFooter1: looooooooooooooooooooooooooooooooooooooooog\r\n   \r\n  fghij\r\n\r\n";
         final ReadableByteChannel channel1 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
         final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
-                MessageConstraints.DEFAULT, Consts.ASCII);
+                MessageConstraints.DEFAULT, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics1 = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
 
@@ -458,9 +458,9 @@ public class TestChunkDecoder {
         Assert.assertEquals(1, footers.length);
 
         final ReadableByteChannel channel2 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
         final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
-                MessageConstraints.lineLen(25), Consts.ASCII);
+                MessageConstraints.lineLen(25), StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics2 = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, metrics2);
 
@@ -477,9 +477,9 @@ public class TestChunkDecoder {
         final String s = "10\r\n1234567890123456\r\n" +
                 "0\r\nFooter1: blah\r\n  blah\r\n  blah\r\n  blah\r\n  blah\r\n  blah\r\n  blah\r\n  blah\r\n\r\n";
         final ReadableByteChannel channel1 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
         final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
-                MessageConstraints.DEFAULT, Consts.ASCII);
+                MessageConstraints.DEFAULT, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics1 = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
 
@@ -494,9 +494,9 @@ public class TestChunkDecoder {
 
         final MessageConstraints constraints = MessageConstraints.lineLen(25);
         final ReadableByteChannel channel2 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
         final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
-                constraints, Consts.ASCII);
+                constraints, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics2 = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, constraints, metrics2);
 
@@ -513,9 +513,9 @@ public class TestChunkDecoder {
         final String s = "10\r\n1234567890123456\r\n" +
                 "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}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
         final SessionInputBuffer inbuf1 = new SessionInputBufferImpl(1024, 256,
-                MessageConstraints.DEFAULT, Consts.ASCII);
+                MessageConstraints.DEFAULT, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics1 = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder1 = new ChunkDecoder(channel1, inbuf1, metrics1);
 
@@ -531,9 +531,9 @@ public class TestChunkDecoder {
         final MessageConstraints constraints = MessageConstraints.custom()
                 .setMaxHeaderCount(3).build();
         final ReadableByteChannel channel2 = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
         final SessionInputBuffer inbuf2 = new SessionInputBufferImpl(1024, 256,
-                constraints, Consts.ASCII);
+                constraints, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics2 = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder2 = new ChunkDecoder(channel2, inbuf2, constraints, metrics2);
 
@@ -548,9 +548,9 @@ public class TestChunkDecoder {
     @Test
     public void testInvalidConstructor() {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff;", "more stuff"}, Consts.ASCII);
+                new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         try {
             new ChunkDecoder(null, null, null);
             Assert.fail("IllegalArgumentException should have been thrown");
@@ -576,9 +576,9 @@ public class TestChunkDecoder {
         final 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";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final ChunkDecoder decoder = new ChunkDecoder(channel, inbuf, metrics);
         decoder.read(null);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkEncoder.java Thu Nov 26 03:47:23 2015
@@ -29,8 +29,8 @@ package org.apache.hc.core5.http.impl.ni
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.TrailerSupplier;
 import org.apache.hc.core5.http.impl.io.HttpTransportMetricsImpl;
@@ -60,7 +60,7 @@ public class TestChunkEncoder {
 
         outbuf.flush(channel);
 
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertTrue(encoder.isCompleted());
         Assert.assertEquals("5\r\n12345\r\n3\r\n678\r\n2\r\n90\r\n0\r\n\r\n", s);
@@ -78,7 +78,7 @@ public class TestChunkEncoder {
 
         outbuf.flush(channel);
 
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertTrue(encoder.isCompleted());
         Assert.assertEquals("4\r\n1234\r\n0\r\n\r\n", s);
@@ -113,7 +113,7 @@ public class TestChunkEncoder {
         Assert.assertEquals(0, encoder.write(src));
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
         Assert.assertEquals("4\r\n0123\r\n4\r\n4567\r\n2\r\n89\r\n4\r\nABCD\r\n2\r\nEF\r\n", s);
     }
 
@@ -131,7 +131,7 @@ public class TestChunkEncoder {
         Mockito.verify(channel, Mockito.never()).write(Matchers.<ByteBuffer>any());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
         Assert.assertEquals("10\r\n0123456789ABCDEF\r\n10\r\n0123456789ABCDEF\r\n" +
                 "10\r\n0123456789ABCDEF\r\n", s);
     }
@@ -149,7 +149,7 @@ public class TestChunkEncoder {
         Assert.assertEquals(0, src.remaining());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
         Assert.assertEquals("4\r\n0123\r\n4\r\n4567\r\n4\r\n89AB\r\n4\r\nCDEF\r\n", s);
 
     }
@@ -174,7 +174,7 @@ public class TestChunkEncoder {
 
         outbuf.flush(channel);
 
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertTrue(encoder.isCompleted());
         Assert.assertEquals("5\r\n12345\r\n3\r\n678\r\n2\r\n90\r\n0\r\n\r\n", s);
@@ -251,7 +251,7 @@ public class TestChunkEncoder {
 
         outbuf.flush(channel);
 
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertTrue(encoder.isCompleted());
         Assert.assertEquals("1\r\n1\r\n2\r\n23\r\n0\r\nE: \r\nY: Z\r\n\r\n", s);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpClientConnection.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpClientConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpClientConnection.java Thu Nov 26 03:47:23 2015
@@ -29,9 +29,9 @@ package org.apache.hc.core5.http.impl.ni
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
 import java.nio.channels.SelectionKey;
+import java.nio.charset.StandardCharsets;
 import java.util.LinkedList;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.HeaderElements;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpHeaders;
@@ -184,7 +184,7 @@ public class TestDefaultNHttpClientConne
 
         Assert.assertNull(conn.getHttpRequest());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 5\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 5\r\n\r\nstuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -210,7 +210,7 @@ public class TestDefaultNHttpClientConne
 
         Assert.assertNull(conn.getHttpRequest());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 22\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 22\r\n\r\na lot of various stuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -236,7 +236,7 @@ public class TestDefaultNHttpClientConne
 
         Assert.assertNull(conn.getHttpRequest());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 5\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 5\r\n\r\nstuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -263,7 +263,7 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.getHttpRequest());
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\nContent-Length: 22\r\n\r\na lot of various stuff",
-                wchannel.dump(Consts.ASCII));
+                wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -348,7 +348,7 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.getHttpRequest());
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" +
-                "5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(Consts.ASCII));
+                "5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -378,7 +378,7 @@ public class TestDefaultNHttpClientConne
         Assert.assertNull(conn.getHttpRequest());
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("POST / HTTP/1.1\r\nTransfer-Encoding: chunked\r\n\r\n" +
-                "5\r\na lot\r\n11\r\n of", wchannel.dump(Consts.ASCII));
+                "5\r\na lot\r\n11\r\n of", wchannel.dump(StandardCharsets.US_ASCII));
         Assert.assertEquals(21, conn.outbuf.length());
 
         Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
@@ -457,7 +457,7 @@ public class TestDefaultNHttpClientConne
     @Test
     public void testConsumeInputShortMessage() throws Exception {
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nstuff"}, Consts.ASCII));
+            new String[] {"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nstuff"}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -502,7 +502,7 @@ public class TestDefaultNHttpClientConne
         conn = new DefaultNHttpClientConnection(session, 1024);
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
             new String[] {"HTTP/1.1 200 OK\r\nContent-Length: 100\r\n\r\na lot of stuff",
-                "", ""}, Consts.ASCII));
+                "", ""}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -554,7 +554,7 @@ public class TestDefaultNHttpClientConne
     @Test
     public void testConsumeInputBasicMessageNoEntity() throws Exception {
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"HTTP/1.1 100 Continue\r\n\r\n"}, Consts.ASCII));
+            new String[] {"HTTP/1.1 100 Continue\r\n\r\n"}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -592,7 +592,7 @@ public class TestDefaultNHttpClientConne
     public void testConsumeInputNoData() throws Exception {
         conn = new DefaultNHttpClientConnection(session, 1024);
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"", ""}, Consts.ASCII));
+            new String[] {"", ""}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -658,7 +658,7 @@ public class TestDefaultNHttpClientConne
     public void testConsumeInputConnectionClosed() throws Exception {
         conn = new DefaultNHttpClientConnection(session, 1024);
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"", ""}, Consts.ASCII));
+            new String[] {"", ""}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestDefaultNHttpServerConnection.java Thu Nov 26 03:47:23 2015
@@ -29,9 +29,9 @@ package org.apache.hc.core5.http.impl.ni
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
 import java.nio.channels.SelectionKey;
+import java.nio.charset.StandardCharsets;
 import java.util.LinkedList;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.HttpEntity;
 import org.apache.hc.core5.http.HttpHeaders;
 import org.apache.hc.core5.http.HttpRequest;
@@ -180,7 +180,7 @@ public class TestDefaultNHttpServerConne
 
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\nstuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
     }
@@ -205,7 +205,7 @@ public class TestDefaultNHttpServerConne
 
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot of various stuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -230,7 +230,7 @@ public class TestDefaultNHttpServerConne
 
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\nstuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\nstuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(1)).write(Matchers.<ByteBuffer>any());
     }
@@ -255,7 +255,7 @@ public class TestDefaultNHttpServerConne
 
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot of various stuff", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot of various stuff", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -280,7 +280,7 @@ public class TestDefaultNHttpServerConne
 
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
-        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na lot", wchannel.dump(StandardCharsets.US_ASCII));
         Assert.assertEquals(17, conn.outbuf.length());
 
         Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
@@ -308,7 +308,7 @@ public class TestDefaultNHttpServerConne
 
         Assert.assertNotNull(conn.getHttpResponse());
         Assert.assertNotNull(conn.contentEncoder);
-        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na loo", wchannel.dump(Consts.ASCII));
+        Assert.assertEquals("HTTP/1.1 200 OK\r\n\r\na loo", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
         Mockito.verify(wchannel, Mockito.times(3)).write(Matchers.<ByteBuffer>any());
@@ -339,7 +339,7 @@ public class TestDefaultNHttpServerConne
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" +
-                "5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(Consts.ASCII));
+                "5\r\na lot\r\n11\r\n of various stuff\r\n0\r\n\r\n", wchannel.dump(StandardCharsets.US_ASCII));
 
         Mockito.verify(wchannel, Mockito.times(2)).write(Matchers.<ByteBuffer>any());
     }
@@ -369,7 +369,7 @@ public class TestDefaultNHttpServerConne
         Assert.assertNull(conn.getHttpResponse());
         Assert.assertNull(conn.contentEncoder);
         Assert.assertEquals("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n" +
-                "5\r\na lot\r\n11\r\n of", wchannel.dump(Consts.ASCII));
+                "5\r\na lot\r\n11\r\n of", wchannel.dump(StandardCharsets.US_ASCII));
         Assert.assertEquals(21, conn.outbuf.length());
 
         Mockito.verify(session, Mockito.never()).clearEvent(SelectionKey.OP_WRITE);
@@ -448,7 +448,7 @@ public class TestDefaultNHttpServerConne
     @Test
     public void testConsumeInputShortMessage() throws Exception {
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"POST / HTTP/1.1\r\nContent-Length: 5\r\n\r\nstuff"}, Consts.ASCII));
+            new String[] {"POST / HTTP/1.1\r\nContent-Length: 5\r\n\r\nstuff"}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -494,7 +494,7 @@ public class TestDefaultNHttpServerConne
         conn = new DefaultNHttpServerConnection(session, 1024);
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
             new String[] {"POST / HTTP/1.1\r\nContent-Length: 100\r\n\r\na lot of stuff",
-                "", ""}, Consts.ASCII));
+                "", ""}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -547,7 +547,7 @@ public class TestDefaultNHttpServerConne
     @Test
     public void testConsumeInputBasicMessageNoEntity() throws Exception {
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"GET / HTTP/1.1\r\n\r\n"}, Consts.ASCII));
+            new String[] {"GET / HTTP/1.1\r\n\r\n"}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -584,7 +584,7 @@ public class TestDefaultNHttpServerConne
     public void testConsumeInputNoData() throws Exception {
         conn = new DefaultNHttpServerConnection(session, 1024);
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"", ""}, Consts.ASCII));
+            new String[] {"", ""}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);
@@ -650,7 +650,7 @@ public class TestDefaultNHttpServerConne
     public void testConsumeInputConnectionClosed() throws Exception {
         conn = new DefaultNHttpServerConnection(session, 1024);
         final ReadableByteChannelMock rchannel = Mockito.spy(new ReadableByteChannelMock(
-            new String[] {"", ""}, Consts.ASCII));
+            new String[] {"", ""}, StandardCharsets.US_ASCII));
         final ByteChannelMock channel = new ByteChannelMock(rchannel, null);
         Mockito.when(session.channel()).thenReturn(channel);
         Mockito.when(session.getEventMask()).thenReturn(SelectionKey.OP_READ);

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestHttpMessageParser.java Thu Nov 26 03:47:23 2015
@@ -33,8 +33,8 @@ import java.io.UnsupportedEncodingExcept
 import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.HttpException;
 import org.apache.hc.core5.http.HttpRequest;
 import org.apache.hc.core5.http.HttpResponse;
@@ -59,12 +59,12 @@ public class TestHttpMessageParser {
 
     private static ReadableByteChannel newChannel(final String s)
             throws UnsupportedEncodingException {
-        return newChannel(s, Consts.ASCII);
+        return newChannel(s, StandardCharsets.US_ASCII);
     }
 
     @Test
     public void testSimpleParsing() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
         inbuf.fill(newChannel("GET /whatever HTTP/1.1\r\nSome header: stuff\r\n\r\n"));
         final HttpRequest request = requestParser.parse(inbuf, false);
@@ -75,7 +75,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingChunkedMessages() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         inbuf.fill(newChannel("GET /whatev"));
@@ -95,7 +95,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingFoldedHeaders() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         inbuf.fill(newChannel("GET /whatev"));
@@ -124,7 +124,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingBadlyFoldedFirstHeader() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         inbuf.fill(newChannel("GET /whatev"));
@@ -150,7 +150,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingEmptyFoldedHeader() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         inbuf.fill(newChannel("GET /whatev"));
@@ -179,7 +179,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingIncompleteRequestLine() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         final ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0");
@@ -191,7 +191,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingIncompleteHeader() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         final ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: whatever");
@@ -204,7 +204,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = HttpException.class)
     public void testParsingInvalidRequestLine() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         final ReadableByteChannel channel = newChannel("GET garbage\r\n");
@@ -214,7 +214,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testResetParser() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
 
         ReadableByteChannel channel = newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n");
@@ -236,7 +236,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = IOException.class)
     public void testLineLimitForStatus() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(
                 MessageConstraints.lineLen(0));
         inbuf.fill(newChannel("GET /whatever HTTP/1.0\r\nHeader: one\r\n\r\n"));
@@ -250,7 +250,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = IOException.class)
     public void testLineLimitForHeader() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
 
         NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(
                 MessageConstraints.lineLen(0));
@@ -268,7 +268,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = IOException.class)
     public void testLineLimitForFoldedHeader() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
 
         final MessageConstraints constraints = MessageConstraints.custom()
                 .setMaxHeaderCount(2).setMaxLineLength(15).build();
@@ -280,7 +280,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = IOException.class)
     public void testMaxHeaderCount() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
 
         final MessageConstraints constraints = MessageConstraints.custom()
                 .setMaxHeaderCount(2).setMaxLineLength(-1).build();
@@ -296,7 +296,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = IOException.class)
     public void testDetectLineLimitEarly() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(2, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(2, 128, StandardCharsets.US_ASCII);
 
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(
                 MessageConstraints.lineLen(2));
@@ -309,7 +309,7 @@ public class TestHttpMessageParser {
 
     @Test
     public void testParsingEmptyLines() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final MessageConstraints constraints = MessageConstraints.custom()
                 .setMaxEmptyLineCount(3).build();
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser(constraints);
@@ -322,7 +322,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = MessageConstraintException.class)
     public void testParsingTooManyEmptyLines() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
 
         final MessageConstraints constraints = MessageConstraints.custom()
                 .setMaxEmptyLineCount(3).build();
@@ -333,7 +333,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = UnsupportedHttpVersionException.class)
     public void testParsingUnsupportedRequestVersion() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpRequest> requestParser = new DefaultHttpRequestParser();
         inbuf.fill(newChannel("GET /whatever HTTP/2.0\r\nSome header: stuff\r\n\r\n"));
         requestParser.parse(inbuf, false);
@@ -341,7 +341,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = UnsupportedHttpVersionException.class)
     public void testParsingUnsupportedVersion() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpResponse> requestParser = new DefaultHttpResponseParser();
         inbuf.fill(newChannel("HTTP/2.0 200 OK\r\nSome header: stuff\r\n\r\n"));
         requestParser.parse(inbuf, false);
@@ -349,7 +349,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = HttpException.class)
     public void testParsingInvalidStatusLine() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpResponse> responseParser = new DefaultHttpResponseParser();
 
         final ReadableByteChannel channel = newChannel("HTTP 200 OK\r\n");
@@ -359,7 +359,7 @@ public class TestHttpMessageParser {
 
     @Test(expected = HttpException.class)
     public void testParsingInvalidHeader() throws Exception {
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, StandardCharsets.US_ASCII);
         final NHttpMessageParser<HttpResponse> responseParser = new DefaultHttpResponseParser();
 
         final ReadableByteChannel channel = newChannel("HTTP/1.0 200 OK\r\nstuff\r\n\r\n");

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityDecoder.java Thu Nov 26 03:47:23 2015
@@ -33,8 +33,8 @@ import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.impl.io.HttpTransportMetricsImpl;
 import org.apache.hc.core5.http.nio.SessionInputBuffer;
 import org.junit.After;
@@ -63,9 +63,9 @@ public class TestIdentityDecoder {
     @Test
     public void testBasicDecoding() throws Exception {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff;", "more stuff"}, Consts.ASCII);
+                new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
 
@@ -102,9 +102,9 @@ public class TestIdentityDecoder {
     @Test
     public void testDecodingFromSessionBuffer() throws Exception {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff;", "more stuff"}, Consts.ASCII);
+                new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
 
         inbuf.fill(channel);
@@ -145,9 +145,9 @@ public class TestIdentityDecoder {
     @Test
     public void testBasicDecodingFile() throws Exception {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, Consts.ASCII);
+                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final IdentityDecoder decoder = new IdentityDecoder(
                 channel, inbuf, metrics);
@@ -175,9 +175,9 @@ public class TestIdentityDecoder {
     @Test
     public void testDecodingFileWithBufferedSessionData() throws Exception {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, Consts.ASCII);
+                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final IdentityDecoder decoder = new IdentityDecoder(
                 channel, inbuf, metrics);
@@ -209,9 +209,9 @@ public class TestIdentityDecoder {
     @Test
     public void testDecodingFileWithOffsetAndBufferedSessionData() throws Exception {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, Consts.ASCII);
+                new String[] {"stuff; ", "more stuff; ", "a lot more stuff!"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final IdentityDecoder decoder = new IdentityDecoder(
                 channel, inbuf, metrics);
@@ -219,7 +219,7 @@ public class TestIdentityDecoder {
         final int i = inbuf.fill(channel);
         Assert.assertEquals(7, i);
 
-        final byte[] beginning = "beginning; ".getBytes(Consts.ASCII);
+        final byte[] beginning = "beginning; ".getBytes(StandardCharsets.US_ASCII);
 
         createTempFile();
         RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
@@ -256,9 +256,9 @@ public class TestIdentityDecoder {
     @Test
     public void testWriteBeyondFileSize() throws Exception {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"a"}, Consts.ASCII);
+                new String[] {"a"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final IdentityDecoder decoder = new IdentityDecoder(
                 channel, inbuf, metrics);
@@ -280,9 +280,9 @@ public class TestIdentityDecoder {
     @Test
     public void testInvalidConstructor() {
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {"stuff;", "more stuff"}, Consts.ASCII);
+                new String[] {"stuff;", "more stuff"}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         try {
             new IdentityDecoder(null, null, null);
             Assert.fail("IllegalArgumentException should have been thrown");
@@ -307,9 +307,9 @@ public class TestIdentityDecoder {
     public void testInvalidInput() throws Exception {
         final String s = "stuff";
         final ReadableByteChannel channel = new ReadableByteChannelMock(
-                new String[] {s}, Consts.ASCII);
+                new String[] {s}, StandardCharsets.US_ASCII);
 
-        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, Consts.ASCII);
+        final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 256, StandardCharsets.US_ASCII);
         final HttpTransportMetricsImpl metrics = new HttpTransportMetricsImpl();
         final IdentityDecoder decoder = new IdentityDecoder(channel, inbuf, metrics);
 

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java?rev=1716559&r1=1716558&r2=1716559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/hc/core5/http/impl/nio/TestIdentityEncoder.java Thu Nov 26 03:47:23 2015
@@ -32,8 +32,8 @@ import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
+import java.nio.charset.StandardCharsets;
 
-import org.apache.hc.core5.http.Consts;
 import org.apache.hc.core5.http.impl.io.HttpTransportMetricsImpl;
 import org.apache.hc.core5.http.nio.SessionOutputBuffer;
 import org.apache.hc.core5.util.CharArrayBuffer;
@@ -76,7 +76,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(5, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff", s);
         Assert.assertEquals("[identity; completed: true]", encoder.toString());
@@ -98,7 +98,7 @@ public class TestIdentityEncoder {
         encoder.complete();
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertTrue(encoder.isCompleted());
         Assert.assertEquals("stuff", s);
@@ -158,8 +158,8 @@ public class TestIdentityEncoder {
         createTempFile();
         RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
         try {
-            testfile.write("stuff;".getBytes(Consts.ASCII));
-            testfile.write("more stuff".getBytes(Consts.ASCII));
+            testfile.write("stuff;".getBytes(StandardCharsets.US_ASCII));
+            testfile.write("more stuff".getBytes(StandardCharsets.US_ASCII));
         } finally {
             testfile.close();
         }
@@ -172,7 +172,7 @@ public class TestIdentityEncoder {
             testfile.close();
         }
 
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertFalse(encoder.isCompleted());
         Assert.assertEquals("stuff;more stuff", s);
@@ -201,7 +201,7 @@ public class TestIdentityEncoder {
             testfile.close();
         }
 
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertFalse(encoder.isCompleted());
         Assert.assertEquals("stuff;more stuff", s);
@@ -218,8 +218,8 @@ public class TestIdentityEncoder {
         createTempFile();
         RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
         try {
-            testfile.write("stuff;".getBytes(Consts.ASCII));
-            testfile.write("more stuff".getBytes(Consts.ASCII));
+            testfile.write("stuff;".getBytes(StandardCharsets.US_ASCII));
+            testfile.write("more stuff".getBytes(StandardCharsets.US_ASCII));
         } finally {
             testfile.close();
         }
@@ -231,7 +231,7 @@ public class TestIdentityEncoder {
         } finally {
             testfile.close();
         }
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertFalse(encoder.isCompleted());
         Assert.assertEquals("stuff;more stuff", s);
@@ -252,8 +252,8 @@ public class TestIdentityEncoder {
         createTempFile();
         RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
         try {
-            testfile.write("stuff;".getBytes(Consts.ASCII));
-            testfile.write("more stuff".getBytes(Consts.ASCII));
+            testfile.write("stuff;".getBytes(StandardCharsets.US_ASCII));
+            testfile.write("more stuff".getBytes(StandardCharsets.US_ASCII));
         } finally {
             testfile.close();
         }
@@ -265,7 +265,7 @@ public class TestIdentityEncoder {
         } finally {
             testfile.close();
         }
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertFalse(encoder.isCompleted());
         Assert.assertEquals("header\r\nstuff;more stuff", s);
@@ -286,7 +286,7 @@ public class TestIdentityEncoder {
         createTempFile();
         RandomAccessFile testfile = new RandomAccessFile(this.tmpfile, "rw");
         try {
-            testfile.write("stuff".getBytes(Consts.ASCII));
+            testfile.write("stuff".getBytes(StandardCharsets.US_ASCII));
         } finally {
             testfile.close();
         }
@@ -299,7 +299,7 @@ public class TestIdentityEncoder {
         } finally {
             testfile.close();
         }
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertFalse(encoder.isCompleted());
         Assert.assertEquals("head", s);
@@ -324,7 +324,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(13, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("header\r\nstuff", s);
     }
@@ -348,7 +348,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(0, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("header\r\nstuff", s);
     }
@@ -371,7 +371,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(0, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff-more stuff", s);
     }
@@ -395,7 +395,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(13, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
         Assert.assertEquals("header\r\nstuff", s);
     }
 
@@ -419,7 +419,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(18, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff---more stuff", s);
     }
@@ -444,7 +444,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(18, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff---more stuff", s);
     }
@@ -471,7 +471,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(21, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff------more stuff", s);
     }
@@ -494,7 +494,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(3, outbuf.length());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff-stuff", s);
     }
@@ -517,7 +517,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(0, outbuf.length());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff-much more stuff", s);
     }
@@ -546,7 +546,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(8, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff---", s);
         Assert.assertEquals(3, outbuf.length());
@@ -571,7 +571,7 @@ public class TestIdentityEncoder {
         Assert.assertEquals(8, metrics.getBytesTransferred());
 
         outbuf.flush(channel);
-        final String s = channel.dump(Consts.ASCII);
+        final String s = channel.dump(StandardCharsets.US_ASCII);
 
         Assert.assertEquals("stuff--m", s);
         Assert.assertEquals(0, outbuf.length());



Mime
View raw message