Examples of refCnt()


Examples of io.netty.buffer.ByteBuf.refCnt()

        if (msg instanceof WebsocketErrorMessage) {
            handle((WebsocketErrorMessage) msg, ctx.channel(), out);
        }

        if (out.refCnt() > 0) {
            log.warn("Buf for message: {} has not been deallocated, refCnt: {}! Forcing release it!", msg, out.refCnt());
            out.release();
        }
    }

    private void handle(AuthorizeMessage authMsg, Channel channel, ByteBuf out) throws IOException {
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    decodeAndVerify(ch, slices[2], envelopes[1], envelopes[2]);

    Assert.assertEquals(refCount - 1, slices[2].refCnt());
    Assert.assertTrue(ch.config().isAutoRead());

    Assert.assertEquals(1, buf.refCnt());
    buf.release();
  }

  @Test
  public void testBufferStagingStagedBufferException() throws Exception {
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    when(this.bufferProvider.registerBufferAvailabilityListener(Matchers.<BufferAvailabilityListener>anyObject()))
        .thenReturn(BufferAvailabilityRegistration.SUCCEEDED_REGISTERED);

    // --------------------------------------------------------------------

    int refCount = buf.refCnt();

    decodeAndVerify(ch, buf);

    Assert.assertFalse(ch.config().isAutoRead());
    Assert.assertEquals(refCount + 1, buf.refCnt());
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    int refCount = buf.refCnt();

    decodeAndVerify(ch, buf);

    Assert.assertFalse(ch.config().isAutoRead());
    Assert.assertEquals(refCount + 1, buf.refCnt());

    try {
      decodeAndVerify(ch, buf);
      Assert.fail("Expected IllegalStateException not thrown");
    } catch (IllegalStateException e) {
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    // --------------------------------------------------------------------

    ByteBuf buf = encode(ch, envelopes);

    decodeAndVerify(ch, buf, envelopes);
    Assert.assertEquals(0, buf.refCnt());
  }

  @Test
  public void testBufferAvailabilityRegistrationBufferPoolDestroyedSkipBytes() throws Exception {
    final EmbeddedChannel ch = new EmbeddedChannel(
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

      decodeAndVerify(ch, slices[2], expectedEnvelopes);
      Assert.assertEquals(refCount - 1, slices[2].refCnt());
    }

    // ref count should be 1, because slices shared the ref count
    Assert.assertEquals(1, buf.refCnt());
  }

  @Test
  public void testEncodeDecode() throws Exception {
    final EmbeddedChannel ch = new EmbeddedChannel(
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    // 1. complete ByteBuf as input
    int refCount = buf.retain().refCnt();

    decodeAndVerify(ch, buf, envelopes);
    Assert.assertEquals(refCount - 1, buf.refCnt());

    // 2. random slices
    buf.readerIndex(0);
    ByteBuf[] slices = randomSlices(buf);
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    Envelope[] expected = randomBufferAvailabilityRegistrationAnswer.removeSkippedEnvelopes(envelopes);

    decodeAndVerify(ch, expected);

    Assert.assertEquals(1, buf.refCnt());

    buf.release();
  }

  // ========================================================================
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    decodeAndVerify(ch, slices[2], envelopes[1], envelopes[2]);

    Assert.assertEquals(refCount - 1, slices[2].refCnt());
    Assert.assertTrue(ch.config().isAutoRead());

    Assert.assertEquals(1, buf.refCnt());
    buf.release();
  }

  @Test
  public void testBufferStagingStagedBufferException() throws Exception {
View Full Code Here

Examples of io.netty.buffer.ByteBuf.refCnt()

    when(this.bufferProvider.registerBufferAvailabilityListener(Matchers.<BufferAvailabilityListener>anyObject()))
        .thenReturn(BufferAvailabilityRegistration.SUCCEEDED_REGISTERED);

    // --------------------------------------------------------------------

    int refCount = buf.refCnt();

    decodeAndVerify(ch, buf);

    Assert.assertFalse(ch.config().isAutoRead());
    Assert.assertEquals(refCount + 1, buf.refCnt());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.