/** * Creates a new embedder whose pipeline is composed of the specified * handlers. * * @param bufferFactory the {@link ChannelBufferFactory} to be used when * creating a new buffer. */ protected AbstractCodecEmbedder(ChannelBufferFactory bufferFactory, ChannelHandler... handlers) { this(handlers); getChannel().getConfig().setBufferFactory(bufferFactory); }
/** * Creates a new embedder whose pipeline is composed of the specified * handlers. * * @param bufferFactory the {@link ChannelBufferFactory} to be used when * creating a new buffer. */ public HandlerEmbedder(ChannelBufferFactory bufferFactory, ChannelHandler... handlers) { this( handlers ); getChannel().getConfig().setBufferFactory( bufferFactory ); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { Channel channel = e.getChannel(); if (OPTIMIZE_PERFORMANCE_CLIENT) { channel.getConfig().setBufferFactory(CHANNEL_BUFFER_FACTORY); } ChannelIoSession<?> session = service.createSession(channel); String baseName = ctx.getName(); String name = format("%s#session", baseName); ChannelHandler handler = new IoSessionChannelHandler(session, future, initializer, service.getSessionIdleTracker()); ChannelPipeline pipeline = ctx.getPipeline(); pipeline.addAfter(baseName, name, handler); ctx.sendUpstream(e); pipeline.remove(this); }
if (connectFuture.isSuccess()) { transport = connectFuture.getChannel(); transport.getConfig().setBufferFactory(tlsConnectConfig.getBufferFactory());
transport.getConfig().setBufferFactory(tlsChildConfig.getBufferFactory()); this.tlsChildChannel = tlsChildChannel;
@Override public void operationComplete(ChannelFuture connectFuture) throws Exception { if (connectFuture.isSuccess()) { transport = connectFuture.getChannel(); transport.getConfig().setBufferFactory(httpConnectConfig.getBufferFactory()); ChannelPipeline pipeline = transport.getPipeline(); ChannelHandlerContext ctx = pipeline.getContext(HttpClientChannelSource.class); HttpClientChannelSource channelSource = (HttpClientChannelSource) ctx.getHandler(); if (!httpConnectChannel.isBound()) { ChannelAddress httpLocalAddress = httpRemoteAddress; httpConnectChannel.setLocalAddress(httpLocalAddress); httpConnectChannel.setBound(); fireChannelBound(httpConnectChannel, httpLocalAddress); } channelSource.setHttpChannel(httpConnectChannel); httpConnectChannel.setRemoteAddress(httpRemoteAddress); httpConnectChannel.setConnected(); httpConnectFuture.setSuccess(); fireChannelConnected(httpConnectChannel, httpRemoteAddress); } else { httpConnectFuture.setFailure(connectFuture.getCause()); } } });
httpChildConfig.setStatus(HttpResponseStatus.OK); transport.getConfig().setBufferFactory(httpChildConfig.getBufferFactory()); this.httpChildChannel = httpChildChannel;