public ChannelPipeline getPipeline() throws Exception { log.debug("Creating client channel pipeline"); ChannelPipeline pipeline = Channels.pipeline(); SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(true); SslHandler sslHandler = new SslHandler(engine); sslHandler.setCloseOnSSLException(true); pipeline.addLast("ssl", sslHandler); pipeline.addLast("chunker", new ChunkedWriteHandler()); pipeline.addLast( "framer", new DelimiterBasedFrameDecoder(protocol.maxHeaderLength(), protocol.headerDelimiter())); pipeline.addLast("stringDecoder", new StringDecoder(protocol.headerCharset())); pipeline.addLast("stringEncoder", new StringEncoder(protocol.headerCharset())); HeaderCodec headerCodec = new HeaderCodec(protocol); pipeline.addLast("headerDecoder", headerCodec.decoder()); pipeline.addLast("headerEncoder", headerCodec.encoder()); pipeline.addLast("client", new ClientHandler(store)); return pipeline; }