Example usage for io.netty.util AbstractReferenceCounted AbstractReferenceCounted

List of usage examples for io.netty.util AbstractReferenceCounted AbstractReferenceCounted

Introduction

In this page you can find the example usage for io.netty.util AbstractReferenceCounted AbstractReferenceCounted.

Prototype

AbstractReferenceCounted

Source Link

Usage

From source file:com.linecorp.armeria.common.stream.AbstractStreamMessageAndWriterTest.java

License:Apache License

@Test
public void rejectReferenceCounted() {
    AbstractReferenceCounted item = new AbstractReferenceCounted() {
        @Override/*from  ww  w.j a  va  2 s. c om*/
        protected void deallocate() {
        }

        @Override
        public ReferenceCounted touch(Object hint) {
            return this;
        }
    };
    StreamMessageAndWriter<Object> stream = newStreamWriter(ImmutableList.of(item));
    assertThatThrownBy(() -> stream.write(item)).isInstanceOf(IllegalArgumentException.class);
}

From source file:com.linecorp.armeria.common.stream.DefaultStreamMessageTest.java

License:Apache License

@Test
public void rejectReferenceCounted() {
    final DefaultStreamMessage<Object> m = new DefaultStreamMessage<>();
    assertThatThrownBy(() -> m.write(new AbstractReferenceCounted() {
        @Override//  ww  w .j  av  a  2s.  c om
        protected void deallocate() {
        }

        @Override
        public ReferenceCounted touch(Object hint) {
            return this;
        }
    })).isInstanceOf(IllegalArgumentException.class);
}