public void ReleaseWhenMergeCumulateThrows() { WriteFailingByteBuf oldCumulation = new WriteFailingByteBuf(1, 64); oldCumulation.WriteZero(1); var input = Unpooled.Buffer().WriteZero(12); Exception thrown = null; try { ByteToMessageDecoder.MergeCumulator.Cumulate(UnpooledByteBufferAllocator.Default, oldCumulation, input); } catch (Exception t) { thrown = t; } Assert.Same(oldCumulation.WriteError(), thrown); Assert.Equal(0, input.ReferenceCount); Assert.Equal(1, oldCumulation.ReferenceCount); oldCumulation.Release(); }
public TestAbstractByteBufAllocator(WriteFailingByteBuf newCumulation) => _newCumulation = newCumulation;