Code example for HttpRequestExecutor

0
        @Override 
        public void run() { 
            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            while (!Thread.interrupted()) {
                try { 
                    final int bufsize = 8 * 1024;
                    // Set up incoming HTTP connection 
                    final Socket insocket = this.serversocket.accept();
                    final DefaultBHttpServerConnection inconn = new DefaultBHttpServerConnection(bufsize);
                    System.out.println("Incoming connection from " + insocket.getInetAddress());
                    inconn.bind(insocket);
 
                    // Set up outgoing HTTP connection 
                    final Socket outsocket = new Socket(this.target.getHostName(), this.target.getPort());
                    final DefaultBHttpClientConnection outconn = new DefaultBHttpClientConnection(bufsize);
                    outconn.bind(outsocket);
                    System.out.println("Outgoing connection to " + outsocket.getInetAddress());
 
                    // Start worker thread 
                    final Thread t = new ProxyThread(this.httpService, inconn, outconn);
                    t.setDaemon(true);