List of usage examples for io.netty.buffer ByteBufAllocator DEFAULT
ByteBufAllocator DEFAULT
To view the source code for io.netty.buffer ByteBufAllocator DEFAULT.
Click Source Link
From source file:com.mastfrog.netty.http.client.Initializer.java
License:Open Source License
@Override protected void initChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (ssl) {//from www .j a v a2 s . c o m SslContext clientContext = context == null ? SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build() : context; pipeline.addLast("ssl", new ExceptionForwardingSslHandler( clientContext.newEngine(ByteBufAllocator.DEFAULT, hostPort.host(), hostPort.port()))); } pipeline.addLast("http-codec", new HttpClientCodec(maxInitialLineLength, maxChunkSize, maxChunkSize)); if (compress) { pipeline.addLast("decompressor", new HttpContentDecompressor()); } pipeline.addLast("handler", handler); }
From source file:com.mongodb.connection.netty.NettyStreamFactoryFactory.java
License:Apache License
/** * Construct an instance with the default {@code EventLoopGroup} and {@code ByteBufAllocator}. */// ww w .j a v a 2s . co m public NettyStreamFactoryFactory() { this(new NioEventLoopGroup(), ByteBufAllocator.DEFAULT); }
From source file:com.spotify.netty4.handler.codec.zmtp.ZMTPMessage.java
License:Apache License
/** * Create a new message from a string frames, using UTF-8 encoding. *///ww w. ja v a 2s . c o m public static ZMTPMessage fromUTF8(final CharSequence... strings) { return from(ByteBufAllocator.DEFAULT, UTF_8, strings); }
From source file:com.spotify.netty4.handler.codec.zmtp.ZMTPMessage.java
License:Apache License
/** * Create a new message from a list of string frames, using a specified encoding. *//*from w ww.j av a 2s . co m*/ public static ZMTPMessage from(final Charset charset, final Iterable<? extends CharSequence> strings) { return from(ByteBufAllocator.DEFAULT, charset, strings); }
From source file:com.spotify.netty4.handler.codec.zmtp.ZMTPMessage.java
License:Apache License
/** * Convenience method for writing a {@link ZMTPMessage} to a {@link ByteBuf}. *///from w w w . j av a 2s . c o m public ByteBuf write(final ZMTPVersion version) { return write(ByteBufAllocator.DEFAULT, version); }
From source file:com.uber.tchannel.codecs.CallRequestFrameCodecTest.java
License:Open Source License
@Test public void testEncodeDecode() throws Exception { CallRequestFrame callRequestFrame = Fixtures.callRequest(42, false, Unpooled.wrappedBuffer("Hello, World!".getBytes())); CallRequestFrame inboundCallRequestFrame = (CallRequestFrame) MessageCodec.decode( CodecTestUtil.encodeDecode(MessageCodec.encode(ByteBufAllocator.DEFAULT, callRequestFrame))); assertEquals("Hello, World!", inboundCallRequestFrame.getPayload().toString(CharsetUtil.UTF_8)); inboundCallRequestFrame.getPayload().release(); }
From source file:com.uber.tchannel.codecs.CallRequestFrameContinueCodecTest.java
License:Open Source License
@Test public void testEncodeDecode() throws Exception { CallRequestContinueFrame callRequestContinueFrame = Fixtures.callRequestContinue(42, false, Unpooled.wrappedBuffer("Hello, World!".getBytes())); CallRequestContinueFrame inboundCallRequestContinueFrame = (CallRequestContinueFrame) MessageCodec .decode(CodecTestUtil/* w w w. j a va 2 s . com*/ .encodeDecode(MessageCodec.encode(ByteBufAllocator.DEFAULT, callRequestContinueFrame))); assertEquals("Hello, World!", inboundCallRequestContinueFrame.getPayload().toString(CharsetUtil.UTF_8)); inboundCallRequestContinueFrame.getPayload().release(); }
From source file:com.uber.tchannel.codecs.CallResponseFrameCodecTest.java
License:Open Source License
@Test public void testEncodeDecode() throws Exception { CallResponseFrame callResponseFrame = Fixtures.callResponse(42, false, Unpooled.wrappedBuffer("Hello, World!".getBytes())); CallResponseFrame inboundCallResponseFrame = (CallResponseFrame) MessageCodec.decode( CodecTestUtil.encodeDecode(MessageCodec.encode(ByteBufAllocator.DEFAULT, callResponseFrame))); assertEquals("Hello, World!", inboundCallResponseFrame.getPayload().toString(CharsetUtil.UTF_8)); inboundCallResponseFrame.release();/*from ww w . jav a 2s . c om*/ }
From source file:com.uber.tchannel.codecs.CallResponseFrameContinueCodecTest.java
License:Open Source License
@Test public void testEncode() throws Exception { CallResponseContinueFrame callRequestContinue = Fixtures.callResponseContinue(42, false, Unpooled.wrappedBuffer("Hello, World!".getBytes())); CallResponseContinueFrame inboundCallResponseContinueFrame = (CallResponseContinueFrame) MessageCodec .decode(CodecTestUtil/*from w w w .j ava 2 s .c o m*/ .encodeDecode(MessageCodec.encode(ByteBufAllocator.DEFAULT, callRequestContinue))); assertEquals("Hello, World!", inboundCallResponseContinueFrame.getPayload().toString(CharsetUtil.UTF_8)); inboundCallResponseContinueFrame.release(); }
From source file:com.uber.tchannel.codecs.ClaimFrameCodecTest.java
License:Open Source License
@Test public void testEncodeDecodeClaim() throws Exception { ClaimFrame claimFrameMessage = new ClaimFrame(Integer.MAX_VALUE, Integer.MAX_VALUE, new Trace(0, 1, 2, (byte) 0x03)); ClaimFrame newClaimFrameMessage = (ClaimFrame) MessageCodec.decode( CodecTestUtil.encodeDecode(MessageCodec.encode(ByteBufAllocator.DEFAULT, claimFrameMessage))); assertEquals(newClaimFrameMessage.getId(), claimFrameMessage.getId()); assertEquals(newClaimFrameMessage.getTTL(), claimFrameMessage.getTTL()); }