Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProvideExpectedMetaData() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldProvideExpectedMetaData()
        {
            ChunkedInput <ByteBuf> replicatedContent = ChunkedReplicatedContent.Chunked(( sbyte )1, new ThreeChunks(this, -1, 8));

            UnpooledByteBufAllocator allocator = UnpooledByteBufAllocator.DEFAULT;

            ByteBuf byteBuf = replicatedContent.readChunk(allocator);

            // is not last
            assertFalse(byteBuf.readBoolean());
            // first chunk has content
            assertEquals(( sbyte )1, byteBuf.readByte());
            byteBuf.release();

            byteBuf = replicatedContent.readChunk(allocator);
            // is not last
            assertFalse(byteBuf.readBoolean());
            byteBuf.release();

            byteBuf = replicatedContent.readChunk(allocator);
            // is last
            assertTrue(byteBuf.readBoolean());
            byteBuf.release();

            assertNull(replicatedContent.readChunk(allocator));
        }
Exemple #2
0
 public override void ChannelRead(ChannelHandlerContext ctx, object msg)
 {
     if (msg is ByteBuf)
     {
         ByteBuf buffer = ( ByteBuf )msg;
         if (_contentTypeProtocol.isExpecting(ContentType.ContentType))
         {
             sbyte       messageCode = buffer.readByte();
             ContentType contentType = GetContentType(messageCode);
             _contentTypeProtocol.expect(contentType);
             if (buffer.readableBytes() == 0)
             {
                 ReferenceCountUtil.release(msg);
                 return;
             }
         }
     }
     ctx.fireChannelRead(msg);
 }
Exemple #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public byte get() throws java.io.IOException
        public override sbyte Get()
        {
            EnsureBytes(Byte.BYTES);
            return(@delegate.readByte());
        }
Exemple #4
0
 public override sbyte ReadByte()
 {
     return(_buf.readByte());
 }