Skip to content

Commit

Permalink
support passing detect context to help build netty handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
icodening committed Jun 6, 2023
1 parent 3717890 commit 1071747
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ void testDetect() {
ByteBuf byteBuf = ByteBufAllocator.DEFAULT.buffer();
ChannelBuffer in = new ByteBufferBackedChannelBuffer(byteBuf.nioBuffer());
ProtocolDetector.Result result = detector.detect(in);
Assertions.assertEquals(result, ProtocolDetector.Result.unrecognized());
Assertions.assertEquals(result.flag(), ProtocolDetector.Result.unrecognized().flag());

byteBuf.writeBytes(connectionPrefaceBuf);
result = detector.detect(new ByteBufferBackedChannelBuffer(byteBuf.nioBuffer()));
Assertions.assertEquals(result, ProtocolDetector.Result.recognized());
Assertions.assertEquals(result.flag(), ProtocolDetector.Result.recognized().flag());

byteBuf.clear();
byteBuf.writeBytes(connectionPrefaceBuf, 0, 1);
result = detector.detect(new ByteBufferBackedChannelBuffer(byteBuf.nioBuffer()));
Assertions.assertEquals(result, ProtocolDetector.Result.needMoreData());
Assertions.assertEquals(result.flag(), ProtocolDetector.Result.needMoreData().flag());

}
}

0 comments on commit 1071747

Please sign in to comment.