public static final ChannelInitializer < Channel > httpClient ( final SimpleChannelInboundHandler < HttpResponse > handler ) { return new ChannelInitializer < Channel > ( ) { @ Override protected void initChannel ( Channel channel ) throws Exception { ChannelPipeline pipeline = channel . pipeline ( ) ; pipeline . addLast ( "httpCodec" , new HttpClientCodec ( ) ) ; pipeline . addLast ( "aggregator" , new HttpObjectAggregator ( 10 * 1024 * 1024 ) ) ; pipeline . addLast ( "httpClientHandler" , handler ) ; } } ; }
Returns a channel initializer suited to decode and process HTTP responses .