Examples of JettyHttpClient


Examples of com.facebook.presto.jdbc.internal.airlift.http.client.jetty.JettyHttpClient

    {
        checkNotNull(userAgent, "userAgent is null");
        checkNotNull(queryResultsCodec, "queryResultsCodec is null");

        this.queryInfoCodec = queryResultsCodec;
        this.httpClient = new JettyHttpClient(
                new HttpClientConfig()
                        .setConnectTimeout(new Duration(10, TimeUnit.SECONDS))
                        .setSocksProxy(socksProxy),
                ImmutableSet.of(new UserAgentRequestFilter(userAgent)));
    }
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.airlift.http.client.jetty.JettyHttpClient

            else {
                log.debug("HttpClient %s uses shared IO thread pool", name);
                ioPoolProvider = injector.getInstance(JettyIoPoolManager.class);
            }

            JettyHttpClient client = new JettyHttpClient(config, ioPoolProvider.get(), ImmutableList.copyOf(filters));
            ioPoolProvider.addClient(client);
            return client;
        }
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

            throws Exception
    {
        balancer = new HttpServiceBalancerImpl("test collector balancer", new TestingReportCollectionFactory().createReportCollection(HttpServiceBalancerStats.class));

        httpClient = new BalancingHttpClient(balancer,
                new JettyHttpClient(new HttpClientConfig().setConnectTimeout(new Duration(10, SECONDS))),
                new BalancingHttpClientConfig());
        servlet = new DummyServlet();
        server = createServer(servlet);
        server.start();
    }
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

            throws Exception
    {
        createServer();
        server.start();

        try (JettyHttpClient httpClient = new JettyHttpClient()) {
            StatusResponse response = httpClient.execute(prepareGet().setUri(httpServerInfo.getHttpUri()).build(), createStatusResponseHandler());

            assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
        }
    }
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

        httpServerInfo = new HttpServerInfo(config, nodeInfo);

        createServer();
        server.start();

        HttpClient client = new JettyHttpClient();
        StatusResponse response = client.execute(prepareGet().setUri(httpServerInfo.getHttpsUri()).build(), createStatusResponseHandler());

        assertEquals(response.getStatusCode(), HttpServletResponse.SC_OK);
    }
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

            throws Exception
    {
        createServer();
        server.start();

        try (JettyHttpClient client = new JettyHttpClient()) {
            StatusResponse response = client.execute(prepareGet().setUri(httpServerInfo.getHttpUri().resolve("/filter")).build(), createStatusResponseHandler());

            assertEquals(response.getStatusCode(), HttpServletResponse.SC_PAYMENT_REQUIRED);
            assertEquals(response.getStatusMessage(), "filtered");
        }
    }
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

    public void testCompressedRequest()
            throws Exception
    {
        createAndStartServer();

        try (JettyHttpClient httpClient = new JettyHttpClient()) {
            StringResponse response = httpClient.execute(
                    preparePut()
                            .setUri(httpServerInfo.getHttpUri())
                            .setHeader("Content-Encoding", "gzip")
                            .setBodyGenerator(createStaticBodyGenerator(new byte[] {
                                    31, -117, 8, 0, -123, -120, -97, 83, 0, 3, 75, -83,
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

        config.setHttpEnabled(false);

        createServer();
        server.start();

        try (HttpClient client = new JettyHttpClient(new HttpClientConfig().setConnectTimeout(new Duration(2.0, TimeUnit.SECONDS)))) {
            StatusResponse response = client.execute(prepareGet().setUri(httpServerInfo.getHttpUri().resolve("/")).build(), createStatusResponseHandler());

            if (response != null) { // TODO: this is a workaround for a bug in AHC (some race condition)
                fail("Expected connection refused, got response code: " + response.getStatusCode());
            }
        }
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

        config.setUserAuthFile(file.getAbsolutePath());

        createServer();
        server.start();

        try (HttpClient client = new JettyHttpClient()) {
            StringResponse response = client.execute(
                    prepareGet()
                            .setUri(httpServerInfo.getHttpUri())
                            .addHeader("Authorization", "Basic " + Base64.encodeBase64String("user:password".getBytes()).trim())
                            .build(),
                    createStringResponseHandler());
View Full Code Here

Examples of com.proofpoint.http.client.jetty.JettyHttpClient

            else {
                log.debug("HttpClient %s uses shared IO thread pool", name);
                ioPoolProvider = injector.getInstance(JettyIoPoolManager.class);
            }

            JettyHttpClient client = new JettyHttpClient(config, ioPoolProvider.get(), ImmutableList.copyOf(filters));
            ioPoolProvider.addClient(client);
            return client;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.