//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = IllegalStateException.class) public void shouldThrowIllegalStatAfterClosed() public virtual void ShouldThrowIllegalStatAfterClosed() { int chunkSize = 8; ChunkingNetworkChannel channel = new ChunkingNetworkChannel(Buffers, chunkSize, new LinkedList <ByteBuf>()); channel.Close(); channel.PutInt(1); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSerializeIntoChunksOfGivenSize() public virtual void ShouldSerializeIntoChunksOfGivenSize() { // given int chunkSize = 8; LinkedList <ByteBuf> byteBufs = new LinkedList <ByteBuf>(); ChunkingNetworkChannel channel = new ChunkingNetworkChannel(Buffers, chunkSize, byteBufs); // and data is written sbyte[] array = new sbyte[10]; channel.Put(( sbyte )1); channel.PutInt(1); channel.PutFloat(1.0f); channel.PutDouble(1.0d); channel.PutShort(( short )1); channel.PutLong(1); channel.Put(array, array.Length); channel.Flush(); // when ByteBuf combinedByteBuf = Buffers.buffer(); ByteBuf byteBuf; while ((byteBuf = byteBufs.RemoveFirst()) != null) { assertEquals(chunkSize, byteBuf.capacity()); combinedByteBuf.writeBytes(byteBuf); } //then assertEquals(( sbyte )1, combinedByteBuf.readByte()); assertEquals(1, combinedByteBuf.readInt()); assertEquals(1.0f, combinedByteBuf.readFloat()); assertEquals(1.0d, combinedByteBuf.readDouble()); assertEquals(( short )1, combinedByteBuf.readShort()); assertEquals(1L, combinedByteBuf.readLong()); sbyte[] bytes = new sbyte[array.Length]; combinedByteBuf.readBytes(bytes); assertArrayEquals(array, bytes); assertEquals(0, combinedByteBuf.readableBytes()); }