@ Override public ChannelPipelineFactory getPipelineFactory ( ) { return new ChannelPipelineFactory ( ) { @ Override public ChannelPipeline getPipeline ( ) throws Exception { final ChannelPipeline cp = Channels . pipeline ( ) ; cp . addLast ( FRAME_DECODER , new FixedLengthFrameDecoder ( 8 ) ) ; cp . addLast ( HANDSHAKE , new Socks4HandshakeHandler ( Socks4ClientBootstrap . super . getPipelineFactory ( ) ) ) ; return cp ; } } ; }
Hijack super class s pipelineFactory and return our own that does the connect to SOCKS proxy and does the handshake .