public static HttpRequest newJDiscRequest(CurrentContainer container, HttpServletRequest servletRequest) {
        try {
            var jettyRequest = (Request) servletRequest;
            var jdiscHttpReq = HttpRequest.newServerRequest(
                    container,
                    getUri(servletRequest),
                    getMethod(servletRequest),
                    HttpRequest.Version.fromString(servletRequest.getProtocol()),
                    new InetSocketAddress(servletRequest.getRemoteAddr(), servletRequest.getRemotePort()),
                    getConnection(jettyRequest).getCreatedTimeStamp(),
                    jettyRequest.getTimeStamp());
            jdiscHttpReq.context().put(RequestUtils.JDISC_REQUEST_X509CERT, getCertChain(servletRequest));
            jdiscHttpReq.context().put(RequestUtils.JDICS_REQUEST_PORT, servletRequest.getLocalPort());
            SSLSession sslSession = (SSLSession) servletRequest.getAttribute(RequestUtils.JETTY_REQUEST_SSLSESSION);
            jdiscHttpReq.context().put(RequestUtils.JDISC_REQUEST_SSLSESSION, sslSession);
            servletRequest.setAttribute(HttpRequest.class.getName(), jdiscHttpReq);
            return jdiscHttpReq;
        } catch (Utf8Appendable.NotUtf8Exception e) {
            throw createBadQueryException(e);
        }
    }
@Test
    final void illegal_host_throws_requestexception3() {
        try {
            HttpRequestFactory.newJDiscRequest(
                    new MockContainer(),
                    createMockRequest("http", "*", "/foo", ""));
            fail("Above statement should throw");
        } catch (RequestException e) {
            assertThat(e.getResponseStatus(), is(Response.Status.BAD_REQUEST));
        }
    }