Examples of alloc()


Examples of io.netty.channel.Channel.alloc()

            totalNb += multipleMessage[i];
        }
        Long start = System.currentTimeMillis();
        int nb = multipleMessage[0];
        for (int i = 0; i < nb; i++) {
            cc.write(cc.alloc().buffer().writeBytes(data));
        }
        cc.flush();

        promise.await();
        Long stop = System.currentTimeMillis();
View Full Code Here

Examples of io.netty.channel.ChannelHandlerContext.alloc()

  @SuppressWarnings("unchecked")
  private ChannelHandlerContext mockChannelHandlerContext(
      final AlternativeCompositeByteBuf buf, final AtomicReference<Message> m2) {
    ChannelHandlerContext ctx = mock(ChannelHandlerContext.class);
    ByteBufAllocator alloc = mock(ByteBufAllocator.class);
    when(ctx.alloc()).thenReturn(alloc);
    when(alloc.ioBuffer()).thenReturn(buf);

    DatagramChannel dc = mock(DatagramChannel.class);
    when(ctx.channel()).thenReturn(dc);
    when(ctx.writeAndFlush(any(), any(ChannelPromise.class))).thenReturn(
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.alloc()

    @Test
    public void readResponseTest() throws Exception {
        EmbeddedChannel embedder = new EmbeddedChannel(new DnsResponseDecoder());
        for (byte[] p: packets) {
            ByteBuf packet = embedder.alloc().buffer(512).writeBytes(p);
            embedder.writeInbound(new DatagramPacket(packet, null, new InetSocketAddress(0)));
            DnsResponse decoded = embedder.readInbound();
            ByteBuf raw = Unpooled.wrappedBuffer(p);
            Assert.assertEquals("Invalid id, expected: " + raw.getUnsignedShort(0) + ", actual: "
                    + decoded.header().id(), raw.getUnsignedShort(0), decoded.header().id());
View Full Code Here

Examples of io.netty.channel.embedded.EmbeddedChannel.alloc()

    public ExpectedException exception = ExpectedException.none();

    @Test
    public void readMalormedResponseTest() throws Exception {
        EmbeddedChannel embedder = new EmbeddedChannel(new DnsResponseDecoder());
        ByteBuf packet = embedder.alloc().buffer(512).writeBytes(malformedLoopPacket);
        exception.expect(CorruptedFrameException.class);
        embedder.writeInbound(new DatagramPacket(packet, null, new InetSocketAddress(0)));
    }
}
View Full Code Here

Examples of org.nustaq.offheap.bytez.malloc.MallocBytezAllocator.alloc()

                CarBench.Accel.class, CarBench.PerformanceFigures.class,
                CarBench.FueldData.class, CarBench.OptionalExtras.class);
//        OffHeapCoder coder = new OffHeapCoder();

        MallocBytezAllocator alloc = new MallocBytezAllocator();
        MallocBytez bytez = (MallocBytez) alloc.alloc(1000 * 1000);

        ohbench(original, coder, bytez);
        ohbench(original, coder, bytez);
        ohbench(original, coder, bytez);
        ohbench(original, coder, bytez);
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.