@Override
        public void run() {
            while (running) {
                synchronized (requests) {
                    if (requests.isEmpty()) {
                        try {
                            requests.wait(100);
                        } catch (InterruptedException e) { return; }
                    } else {
                        Request request = requests.removeFirst();
                        HttpRequest r = request.request;
                        log.fine("Processing request " + r);
                        HttpRequestHandler handler = getHandler(r);
                        if (handler == null) {
                            if (log.isLoggable(Level.FINE)) {
                                log.fine("Failed to find target for request " + r.toString(true));
                                log.fine("Existing handlers:");
                                for (Socket socket : handlers.keySet()) {
                                    log.fine("  Socket " + socket.hostname + ":" + socket.port);
                                    for (Handler h : handlers.get(socket)) {
                                        log.fine("    " + h.pathPrefix);
                                    }
                                }
                            }
                            request.result.setResult(new HttpResult().setHttpCode(
                                    404, "No such server socket with suitable path prefix found open"));
                        } else {
                            try{
                                request.result.setResult(handler.handleRequest(r));
                            } catch (Exception e) {
                                HttpResult result = new HttpResult().setHttpCode(500, e.getMessage());
                                StringWriter sw = new StringWriter();
                                e.printStackTrace(new PrintWriter(sw));
                                result.setContent(sw.toString());
                                request.result.setResult(result);
                            }
                        }
                        //log.fine("Request " + r.toString(true) + " created result " + request.getSecond().getResult().toString(true));
                    }
                }
            }
        }
This class is a utility for unit tests.. You can register HttpRequestHandler instances in it, and then
you can extract an AsyncHttpClient&lt;HttpResult&gt; instance from it, which you can use to talk to the
registered servers. Thus you can do end to end testing of components talking over HTTP without actually
going through HTTP if you are using the HTTP abstraction layer in communication.http package.
clustercontroller-utils/src/test/java/com/yahoo/vespa/clustercontroller/utils/test/TestTransport.java