[#1532] Remove @deprecated ByteBufIndexFinder and all methods that take it as argument

This commit is contained in:
Norman Maurer 2013-07-06 20:14:53 +02:00
parent dfc05a6ed7
commit 7dda4b9ce4
10 changed files with 3 additions and 536 deletions

View File

@ -967,36 +967,17 @@ public abstract class AbstractByteBuf implements ByteBuf {
return ByteBufUtil.indexOf(this, fromIndex, toIndex, value);
}
@Override
@Deprecated
public int indexOf(int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
return ByteBufUtil.indexOf(this, fromIndex, toIndex, indexFinder);
}
@Override
public int bytesBefore(byte value) {
return bytesBefore(readerIndex(), readableBytes(), value);
}
@Override
@Deprecated
public int bytesBefore(ByteBufIndexFinder indexFinder) {
return bytesBefore(readerIndex(), readableBytes(), indexFinder);
}
@Override
public int bytesBefore(int length, byte value) {
checkReadableBytes(length);
return bytesBefore(readerIndex(), length, value);
}
@Override
@Deprecated
public int bytesBefore(int length, ByteBufIndexFinder indexFinder) {
checkReadableBytes(length);
return bytesBefore(readerIndex(), length, indexFinder);
}
@Override
public int bytesBefore(int index, int length, byte value) {
int endIndex = indexOf(index, index + length, value);
@ -1006,16 +987,6 @@ public abstract class AbstractByteBuf implements ByteBuf {
return endIndex - index;
}
@Override
@Deprecated
public int bytesBefore(int index, int length, ByteBufIndexFinder indexFinder) {
int endIndex = indexOf(index, index + length, indexFinder);
if (endIndex < 0) {
return -1;
}
return endIndex - index;
}
@Override
public int forEachByte(ByteBufProcessor processor) {
int index = readerIndex;

View File

@ -1555,27 +1555,6 @@ public interface ByteBuf extends ReferenceCounted, Comparable<ByteBuf> {
*/
int indexOf(int fromIndex, int toIndex, byte value);
/**
* @deprecated Use {@link #forEachByte(int, int, ByteBufProcessor)} instead.
*
* Locates the first place where the specified {@code indexFinder}
* returns {@code true}. The search takes place from the specified
* {@code fromIndex} (inclusive) to the specified {@code toIndex}
* (exclusive).
* <p>
* If {@code fromIndex} is greater than {@code toIndex}, the search is
* performed in a reversed order.
* <p>
* This method does not modify {@code readerIndex} or {@code writerIndex} of
* this buffer.
*
* @return the absolute index where the specified {@code indexFinder}
* returned {@code true}. {@code -1} if the {@code indexFinder}
* did not return {@code true} at all.
*/
@Deprecated
int indexOf(int fromIndex, int toIndex, ByteBufIndexFinder indexFinder);
/**
* Locates the first occurrence of the specified {@code value} in this
* buffer. The search takes place from the current {@code readerIndex}
@ -1589,24 +1568,6 @@ public interface ByteBuf extends ReferenceCounted, Comparable<ByteBuf> {
*/
int bytesBefore(byte value);
/**
* @deprecated Use {@link #forEachByte(ByteBufProcessor)} instead.
*
* Locates the first place where the specified {@code indexFinder} returns
* {@code true}. The search takes place from the current {@code readerIndex}
* (inclusive) to the current {@code writerIndex}.
* <p>
* This method does not modify {@code readerIndex} or {@code writerIndex} of
* this buffer.
*
* @return the number of bytes between the current {@code readerIndex}
* and the first place where the {@code indexFinder} returned
* {@code true}. {@code -1} if the {@code indexFinder} did not
* return {@code true} at all.
*/
@Deprecated
int bytesBefore(ByteBufIndexFinder indexFinder);
/**
* Locates the first occurrence of the specified {@code value} in this
* buffer. The search starts from the current {@code readerIndex}
@ -1623,27 +1584,6 @@ public interface ByteBuf extends ReferenceCounted, Comparable<ByteBuf> {
*/
int bytesBefore(int length, byte value);
/**
* @deprecated Use {@link #forEachByte(int, int, ByteBufProcessor)} instead.
*
* Locates the first place where the specified {@code indexFinder} returns
* {@code true}. The search starts the current {@code readerIndex}
* (inclusive) and lasts for the specified {@code length}.
* <p>
* This method does not modify {@code readerIndex} or {@code writerIndex} of
* this buffer.
*
* @return the number of bytes between the current {@code readerIndex}
* and the first place where the {@code indexFinder} returned
* {@code true}. {@code -1} if the {@code indexFinder} did not
* return {@code true} at all.
*
* @throws IndexOutOfBoundsException
* if {@code length} is greater than {@code this.readableBytes}
*/
@Deprecated
int bytesBefore(int length, ByteBufIndexFinder indexFinder);
/**
* Locates the first occurrence of the specified {@code value} in this
* buffer. The search starts from the specified {@code index} (inclusive)
@ -1660,27 +1600,6 @@ public interface ByteBuf extends ReferenceCounted, Comparable<ByteBuf> {
*/
int bytesBefore(int index, int length, byte value);
/**
* @deprecated Use {@link #forEachByte(int, int, ByteBufProcessor)} instead.
*
* Locates the first place where the specified {@code indexFinder} returns
* {@code true}. The search starts the specified {@code index} (inclusive)
* and lasts for the specified {@code length}.
* <p>
* This method does not modify {@code readerIndex} or {@code writerIndex} of
* this buffer.
*
* @return the number of bytes between the specified {@code index}
* and the first place where the {@code indexFinder} returned
* {@code true}. {@code -1} if the {@code indexFinder} did not
* return {@code true} at all.
*
* @throws IndexOutOfBoundsException
* if {@code index + length} is greater than {@code this.capacity}
*/
@Deprecated
int bytesBefore(int index, int length, ByteBufIndexFinder indexFinder);
/**
* Iterates over the readable bytes of this buffer with the specified {@code processor} in ascending order.
*

View File

@ -1,176 +0,0 @@
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
/**
* @deprecated Use {@link ByteBufProcessor} instead.
*
* Locates an index of data in a {@link ByteBuf}.
* <p>
* This interface enables the sequential search for the data which meets more
* complex and dynamic condition than just a simple value matching. Please
* refer to {@link ByteBuf#indexOf(int, int, ByteBufIndexFinder)} and
* {@link ByteBuf#bytesBefore(int, int, ByteBufIndexFinder)}
* for more explanation.
*/
@Deprecated
public interface ByteBufIndexFinder {
/**
* Returns {@code true} if and only if the data is found at the specified
* {@code guessedIndex} of the specified {@code buffer}.
* <p>
* The implementation should not perform an operation which raises an
* exception such as {@link IndexOutOfBoundsException} nor perform
* an operation which modifies the content of the buffer.
*/
boolean find(ByteBuf buffer, int guessedIndex);
/**
* @deprecated Use {@link ByteBufProcessor#FIND_NUL} instead.
*
* Index finder which locates a {@code NUL (0x00)} byte.
*/
@Deprecated
ByteBufIndexFinder NUL = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return buffer.getByte(guessedIndex) == 0;
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_NON_NUL} instead.
*
* Index finder which locates a non-{@code NUL (0x00)} byte.
*/
@Deprecated
ByteBufIndexFinder NOT_NUL = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return buffer.getByte(guessedIndex) != 0;
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_CR} instead.
*
* Index finder which locates a {@code CR ('\r')} byte.
*/
@Deprecated
ByteBufIndexFinder CR = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return buffer.getByte(guessedIndex) == '\r';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_NON_CR} instead.
*
* Index finder which locates a non-{@code CR ('\r')} byte.
*/
@Deprecated
ByteBufIndexFinder NOT_CR = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return buffer.getByte(guessedIndex) != '\r';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_LF} instead.
*
* Index finder which locates a {@code LF ('\n')} byte.
*/
@Deprecated
ByteBufIndexFinder LF = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return buffer.getByte(guessedIndex) == '\n';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_NON_LF} instead.
*
* Index finder which locates a non-{@code LF ('\n')} byte.
*/
@Deprecated
ByteBufIndexFinder NOT_LF = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return buffer.getByte(guessedIndex) != '\n';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_CRLF} instead.
*
* Index finder which locates a {@code CR ('\r')} or {@code LF ('\n')}.
*/
@Deprecated
ByteBufIndexFinder CRLF = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
byte b = buffer.getByte(guessedIndex);
return b == '\r' || b == '\n';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_NON_CRLF} instead.
*
* Index finder which locates a byte which is neither a {@code CR ('\r')} nor a {@code LF ('\n')}.
*/
@Deprecated
ByteBufIndexFinder NOT_CRLF = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
byte b = buffer.getByte(guessedIndex);
return b != '\r' && b != '\n';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_LINEAR_WHITESPACE} instead.
*
* Index finder which locates a linear whitespace ({@code ' '} and {@code '\t'}).
*/
@Deprecated
ByteBufIndexFinder LINEAR_WHITESPACE = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
byte b = buffer.getByte(guessedIndex);
return b == ' ' || b == '\t';
}
};
/**
* @deprecated Use {@link ByteBufProcessor#FIND_NON_LINEAR_WHITESPACE} instead.
*
* Index finder which locates a byte which is not a linear whitespace (neither {@code ' '} nor {@code '\t'}).
*/
@Deprecated
ByteBufIndexFinder NOT_LINEAR_WHITESPACE = new ByteBufIndexFinder() {
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
byte b = buffer.getByte(guessedIndex);
return b != ' ' && b != '\t';
}
};
}

View File

@ -225,19 +225,6 @@ public final class ByteBufUtil {
}
}
/**
* The default implementation of {@link ByteBuf#indexOf(int, int, ByteBufIndexFinder)}.
* This method is useful when implementing a new buffer type.
*/
@Deprecated
public static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
if (fromIndex <= toIndex) {
return firstIndexOf(buffer, fromIndex, toIndex, indexFinder);
} else {
return lastIndexOf(buffer, fromIndex, toIndex, indexFinder);
}
}
/**
* Toggles the endianness of the specified 16-bit short integer.
*/
@ -300,38 +287,6 @@ public final class ByteBufUtil {
return -1;
}
@SuppressWarnings("deprecation")
private static int firstIndexOf(ByteBuf buffer, int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
fromIndex = Math.max(fromIndex, 0);
if (fromIndex >= toIndex || buffer.capacity() == 0) {
return -1;
}
for (int i = fromIndex; i < toIndex; i ++) {
if (indexFinder.find(buffer, i)) {
return i;
}
}
return -1;
}
@SuppressWarnings("deprecation")
private static int lastIndexOf(ByteBuf buffer, int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
fromIndex = Math.min(fromIndex, buffer.capacity());
if (fromIndex < 0 || buffer.capacity() == 0) {
return -1;
}
for (int i = fromIndex - 1; i >= toIndex; i --) {
if (indexFinder.find(buffer, i)) {
return i;
}
}
return -1;
}
static ByteBuffer encodeString(CharBuffer src, Charset charset) {
final CharsetEncoder encoder = CharsetUtil.getEncoder(charset);
final ByteBuffer dst = ByteBuffer.allocate(

View File

@ -649,51 +649,23 @@ public final class EmptyByteBuf implements ByteBuf {
return -1;
}
@Override
@Deprecated
public int indexOf(int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
checkIndex(fromIndex);
checkIndex(toIndex);
return -1;
}
@Override
public int bytesBefore(byte value) {
return -1;
}
@Override
@Deprecated
public int bytesBefore(ByteBufIndexFinder indexFinder) {
return -1;
}
@Override
public int bytesBefore(int length, byte value) {
checkLength(length);
return -1;
}
@Override
@Deprecated
public int bytesBefore(int length, ByteBufIndexFinder indexFinder) {
checkLength(length);
return -1;
}
@Override
public int bytesBefore(int index, int length, byte value) {
checkIndex(index, length);
return -1;
}
@Override
@Deprecated
public int bytesBefore(int index, int length, ByteBufIndexFinder indexFinder) {
checkIndex(index, length);
return -1;
}
@Override
public int forEachByte(ByteBufProcessor processor) {
return -1;

View File

@ -661,45 +661,21 @@ public final class SwappedByteBuf implements ByteBuf {
return buf.indexOf(fromIndex, toIndex, value);
}
@Override
@Deprecated
public int indexOf(int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
return buf.indexOf(fromIndex, toIndex, indexFinder);
}
@Override
public int bytesBefore(byte value) {
return buf.bytesBefore(value);
}
@Override
@Deprecated
public int bytesBefore(ByteBufIndexFinder indexFinder) {
return buf.bytesBefore(new SwappedByteBufIndexFinder(indexFinder));
}
@Override
public int bytesBefore(int length, byte value) {
return buf.bytesBefore(length, value);
}
@Override
@Deprecated
public int bytesBefore(int length, ByteBufIndexFinder indexFinder) {
return buf.bytesBefore(length, new SwappedByteBufIndexFinder(indexFinder));
}
@Override
public int bytesBefore(int index, int length, byte value) {
return buf.bytesBefore(index, length, value);
}
@Override
@Deprecated
public int bytesBefore(int index, int length, ByteBufIndexFinder indexFinder) {
return buf.bytesBefore(index, length, new SwappedByteBufIndexFinder(indexFinder));
}
@Override
public int forEachByte(ByteBufProcessor processor) {
return buf.forEachByte(processor);
@ -871,21 +847,4 @@ public final class SwappedByteBuf implements ByteBuf {
public String toString() {
return "Swapped(" + buf.toString() + ')';
}
@SuppressWarnings("deprecation")
private final class SwappedByteBufIndexFinder implements ByteBufIndexFinder {
private final ByteBufIndexFinder indexFinder;
SwappedByteBufIndexFinder(ByteBufIndexFinder indexFinder) {
if (indexFinder == null) {
throw new NullPointerException("indexFinder");
}
this.indexFinder = indexFinder;
}
@Override
public boolean find(ByteBuf buffer, int guessedIndex) {
return indexFinder.find(SwappedByteBuf.this, guessedIndex);
}
}
}

View File

@ -667,45 +667,21 @@ final class UnreleasableByteBuf implements ByteBuf {
return buf.indexOf(fromIndex, toIndex, value);
}
@Override
@Deprecated
public int indexOf(int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
return buf.indexOf(fromIndex, toIndex, indexFinder);
}
@Override
public int bytesBefore(byte value) {
return buf.bytesBefore(value);
}
@Override
@Deprecated
public int bytesBefore(ByteBufIndexFinder indexFinder) {
return buf.bytesBefore(indexFinder);
}
@Override
public int bytesBefore(int length, byte value) {
return buf.bytesBefore(length, value);
}
@Override
@Deprecated
public int bytesBefore(int length, ByteBufIndexFinder indexFinder) {
return buf.bytesBefore(length, indexFinder);
}
@Override
public int bytesBefore(int index, int length, byte value) {
return buf.bytesBefore(index, length, value);
}
@Override
@Deprecated
public int bytesBefore(int index, int length, ByteBufIndexFinder indexFinder) {
return buf.bytesBefore(index, length, indexFinder);
}
@Override
public int forEachByte(ByteBufProcessor processor) {
return buf.forEachByte(processor);

View File

@ -1,67 +0,0 @@
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
import io.netty.util.CharsetUtil;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Tests the index-finding capabilities of channel buffers
*/
@SuppressWarnings("deprecation")
public class ByteBufIndexFinderTest {
@Test
public void testForward() {
ByteBuf buf = Unpooled.copiedBuffer(
"abc\r\n\ndef\r\rghi\n\njkl\0\0mno \t\tx",
CharsetUtil.ISO_8859_1);
assertEquals(3, buf.indexOf(Integer.MIN_VALUE, buf.capacity(), ByteBufIndexFinder.CRLF));
assertEquals(6, buf.indexOf(3, buf.capacity(), ByteBufIndexFinder.NOT_CRLF));
assertEquals(9, buf.indexOf(6, buf.capacity(), ByteBufIndexFinder.CR));
assertEquals(11, buf.indexOf(9, buf.capacity(), ByteBufIndexFinder.NOT_CR));
assertEquals(14, buf.indexOf(11, buf.capacity(), ByteBufIndexFinder.LF));
assertEquals(16, buf.indexOf(14, buf.capacity(), ByteBufIndexFinder.NOT_LF));
assertEquals(19, buf.indexOf(16, buf.capacity(), ByteBufIndexFinder.NUL));
assertEquals(21, buf.indexOf(19, buf.capacity(), ByteBufIndexFinder.NOT_NUL));
assertEquals(24, buf.indexOf(21, buf.capacity(), ByteBufIndexFinder.LINEAR_WHITESPACE));
assertEquals(28, buf.indexOf(24, buf.capacity(), ByteBufIndexFinder.NOT_LINEAR_WHITESPACE));
assertEquals(-1, buf.indexOf(28, buf.capacity(), ByteBufIndexFinder.LINEAR_WHITESPACE));
}
@Test
public void testBackward() {
ByteBuf buf = Unpooled.copiedBuffer(
"abc\r\n\ndef\r\rghi\n\njkl\0\0mno \t\tx",
CharsetUtil.ISO_8859_1);
assertEquals(27, buf.indexOf(Integer.MAX_VALUE, 0, ByteBufIndexFinder.LINEAR_WHITESPACE));
assertEquals(23, buf.indexOf(28, 0, ByteBufIndexFinder.NOT_LINEAR_WHITESPACE));
assertEquals(20, buf.indexOf(24, 0, ByteBufIndexFinder.NUL));
assertEquals(18, buf.indexOf(21, 0, ByteBufIndexFinder.NOT_NUL));
assertEquals(15, buf.indexOf(19, 0, ByteBufIndexFinder.LF));
assertEquals(13, buf.indexOf(16, 0, ByteBufIndexFinder.NOT_LF));
assertEquals(10, buf.indexOf(14, 0, ByteBufIndexFinder.CR));
assertEquals(8, buf.indexOf(11, 0, ByteBufIndexFinder.NOT_CR));
assertEquals(5, buf.indexOf(9, 0, ByteBufIndexFinder.CRLF));
assertEquals(2, buf.indexOf(6, 0, ByteBufIndexFinder.NOT_CRLF));
assertEquals(-1, buf.indexOf(3, 0, ByteBufIndexFinder.CRLF));
}
}

View File

@ -17,7 +17,6 @@ package io.netty.handler.codec;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufIndexFinder;
import io.netty.buffer.ByteBufProcessor;
import io.netty.buffer.SwappedByteBuf;
import io.netty.buffer.Unpooled;
@ -300,16 +299,6 @@ final class ReplayingDecoderBuffer implements ByteBuf {
return endIndex;
}
@Override
@Deprecated
public int indexOf(int fromIndex, int toIndex, ByteBufIndexFinder indexFinder) {
int endIndex = buffer.indexOf(fromIndex, toIndex, indexFinder);
if (endIndex < 0) {
throw REPLAY;
}
return endIndex;
}
@Override
public int bytesBefore(byte value) {
int bytes = buffer.bytesBefore(value);
@ -319,16 +308,6 @@ final class ReplayingDecoderBuffer implements ByteBuf {
return bytes;
}
@Override
@Deprecated
public int bytesBefore(ByteBufIndexFinder indexFinder) {
int bytes = buffer.bytesBefore(indexFinder);
if (bytes < 0) {
throw REPLAY;
}
return bytes;
}
@Override
public int bytesBefore(int length, byte value) {
checkReadableBytes(length);
@ -339,17 +318,6 @@ final class ReplayingDecoderBuffer implements ByteBuf {
return bytes;
}
@Override
@Deprecated
public int bytesBefore(int length, ByteBufIndexFinder indexFinder) {
checkReadableBytes(length);
int bytes = buffer.bytesBefore(length, indexFinder);
if (bytes < 0) {
throw REPLAY;
}
return bytes;
}
@Override
public int bytesBefore(int index, int length, byte value) {
int bytes = buffer.bytesBefore(index, length, value);
@ -359,16 +327,6 @@ final class ReplayingDecoderBuffer implements ByteBuf {
return bytes;
}
@Override
@Deprecated
public int bytesBefore(int index, int length, ByteBufIndexFinder indexFinder) {
int bytes = buffer.bytesBefore(index, length, indexFinder);
if (bytes < 0) {
throw REPLAY;
}
return bytes;
}
@Override
public int forEachByte(ByteBufProcessor processor) {
int ret = buffer.forEachByte(processor);

View File

@ -16,7 +16,6 @@
package io.netty.handler.codec;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufIndexFinder;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
@ -57,9 +56,9 @@ public class ReplayingDecoderTest {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, MessageList<Object> out) {
ByteBuf msg = in.readBytes(in.bytesBefore(ByteBufIndexFinder.LF));
in.skipBytes(1);
ByteBuf msg = in.readBytes(in.bytesBefore((byte) '\n'));
out.add(msg);
in.skipBytes(1);
}
}
@ -98,6 +97,7 @@ public class ReplayingDecoderTest {
assertEquals(Unpooled.wrappedBuffer(new byte[] {'C' }), ch.readInbound());
assertNull("Must be null as it must only decode one frame", ch.readInbound());
ch.read();
ch.finish();
assertEquals(Unpooled.wrappedBuffer(new byte[] {'B' }), ch.readInbound());
assertNull(ch.readInbound());