Code example for ConnectionReuseStrategy

Methods: keepAlive

0
 
    static class RequestListenerThread extends Thread {
 
        private final HttpHost target;
        private final ServerSocket serversocket;
        private final HttpService httpService;
 
        public RequestListenerThread(final int port, final HttpHost target) throws IOException {
            this.target = target;
            this.serversocket = new ServerSocket(port);
 
            // Set up HTTP protocol processor for incoming connections 
            final HttpProcessor inhttpproc = new ImmutableHttpProcessor(
                    new HttpRequestInterceptor[] {
                            new RequestContent(),
                            new RequestTargetHost(),
                            new RequestConnControl(),
                            new RequestUserAgent("Test/1.1"),
                            new RequestExpectContinue(true)
             });