@Override
        public void handle(HttpExchange t) throws IOException {
            synchronized (MockHttpServer.this) {
                t.sendResponseHeaders(200, response != null ? response.length() : 0);
                try (OutputStream os = t.getResponseBody()) {
                    if (response != null) os.write(response.getBytes());
                }
            }
        }
Mock http server that will return response as body

@param response the response to return along with 200 OK
@param path     the file path that the server will accept requests for. E.g /state/v1/metrics
metrics-proxy/src/test/java/ai/vespa/metricsproxy/service/MockHttpServer.java