import com.xw.http.*;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaderValues;

/**
 * Author: junjie
 * Date: 3/25/15.
 * Target: <>
 */
public class Foo {
    public static void main(String[] args) {
        final String url = "http://cn.bing.com";
        final String data = "Hello";
        final int timeout = 500;

        NClient.post(new RequestBuilder(url, data) {
                         @Override
                         public FullHttpRequest setup(FullHttpRequest request) {
                             // customize the http headers
                             request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE)
                                     .set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP)
                                     .set(HttpHeaderNames.CONTENT_TYPE, TEXT_XML)
                             ;
                             return (request);
                         }
                     },
                new PipelineBuilder(timeout) {
                    @Override
                    public ChannelPipeline setup(ChannelPipeline pipeline) {
                        // default http content processing

                        pipeline.addLast(new DefaultContentHandler<Integer>(A.OPTION_BLOCK_SIZE) {
                            @Override
                            protected Integer process(String s) {
                                System.out.println(s);
                                return (s.length());
                            }
                        });
                        return (pipeline);
                    }
                });
    }
}

@@ -212,16 +212,100 @@
 rValues;
+%0Aimport org.apache.logging.log4j.LogManager;%0Aimport org.apache.logging.log4j.Logger;
 %0A%0A/**%0A *
@@ -540,16 +540,162 @@
 = 500;%0A%0A
+        callA(%22http://cn.bing.com%22, %22Hello%22, 500);%0A    %7D%0A%0A    private static void callA(final String url, final String data, final int timeout) %7B%0A
         
@@ -1452,16 +1452,22 @@
 e setup(
+final 
 ChannelP
@@ -1785,26 +1785,1874 @@
     
-System.out.println
+_l.info(H.pad_right(String.format(%22##%3CcallB%7CTid:%25d%3E%22,%0A                                        H.tid()), A.OPTION_PROMPT_LEN, %22#%22));%0A                                _l.info(s);%0A%0A                                // conditioning%0A                                callB(%22http://www.baidu.com%22, %22Welcome%22, 500);%0A                                return (s.length());%0A                            %7D%0A                        %7D);%0A                        return (pipeline);%0A                    %7D%0A                %7D);%0A    %7D%0A%0A    private static final void callB(final String url, final String data, final int timeout) %7B%0A        NClient.post(new RequestBuilder(url, data) %7B%0A                         @Override%0A                         public FullHttpRequest setup(FullHttpRequest request) %7B%0A                             // customize the http headers%0A                             request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE)%0A                                     .set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP)%0A                                     .set(HttpHeaderNames.CONTENT_TYPE, TEXT_XML)%0A                             ;%0A                             return (request);%0A                         %7D%0A                     %7D,%0A                new PipelineBuilder(timeout) %7B%0A                    @Override%0A                    public ChannelPipeline setup(final ChannelPipeline pipeline) %7B%0A                        // default http content processing%0A                        pipeline.addLast(new DefaultContentHandler%3CInteger%3E(A.OPTION_BLOCK_SIZE) %7B%0A                            @Override%0A                            protected Integer process(String s) %7B%0A                                _l.info(H.pad_right(String.format(%22##%3CcallB%7CTid:%25d%3E%22,%0A                                        H.tid()), A.OPTION_PROMPT_LEN, %22#%22));%0A                                _l.info
 (s);
@@ -3848,16 +3848,87 @@
     %7D);%0A
-
     %7D
+%0A%0A    private static final Logger _l = LogManager.getLogger(Foo.class);
 %0A%7D%0A

refined Foo for: callA->callB