diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java index b5fffee57a..5a6c08297d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java @@ -457,7 +457,7 @@ public class HttpResponseStatus implements Comparable { int code = Integer.parseInt(status.substring(0, space)); String reasonPhrase = status.substring(space + 1); HttpResponseStatus responseStatus = valueOf(code); - if (responseStatus.reasonPhrase().equals(reasonPhrase)) { + if (responseStatus.reasonPhrase().toString().equals(reasonPhrase)) { return responseStatus; } else { return new HttpResponseStatus(code, reasonPhrase); diff --git a/codec/src/test/java/io/netty/handler/codec/AsciiStringTest.java b/codec/src/test/java/io/netty/handler/codec/AsciiStringTest.java index 52fbcd999a..0d459bc1fc 100644 --- a/codec/src/test/java/io/netty/handler/codec/AsciiStringTest.java +++ b/codec/src/test/java/io/netty/handler/codec/AsciiStringTest.java @@ -23,6 +23,7 @@ import java.nio.CharBuffer; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; +import org.junit.Assert; import org.junit.Test; /** @@ -79,6 +80,13 @@ public class AsciiStringTest { } } + @Test + public void testComparisonWithString() { + String string = "shouldn't fail"; + AsciiString ascii = new AsciiString(string.toCharArray()); + Assert.assertEquals(string, ascii.toString()); + } + private static byte[] getBytesWithEncoder(CharSequence value, Charset charset) { final CharsetEncoder encoder = CharsetUtil.getEncoder(charset); final ByteBuffer nativeBuffer = ByteBuffer.allocate((int) (encoder.maxBytesPerChar() * value.length()));