Package org.glassfish.jersey.client

Examples of org.glassfish.jersey.client.ClientConfig


        client.close();
    }

    @Test
    public void testAuthDelete() {
        ClientConfig config = new ClientConfig();
        config.property(JettyClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION,
                new BasicAuthentication(getBaseUri(), "WallyWorld", "name", "password"));
        config.connectorProvider(new JettyConnectorProvider());
        Client client = ClientBuilder.newClient(config);

        Response response = client.target(getBaseUri()).path(PATH).request().delete();
        assertEquals(response.getStatus(), 204);
        client.close();
View Full Code Here


    }

    @Test
    public void testSlow() {
        final URI u = target().getUri();
        ClientConfig config = new ClientConfig().property(ClientProperties.READ_TIMEOUT, 1000);
        config.connectorProvider(new JettyConnectorProvider());
        Client c = ClientBuilder.newClient(config);
        WebTarget t = c.target(u);
        try {
            t.path("test/timeout").request().get();
        } catch (ProcessingException e) {
View Full Code Here

        }
    }

    @Test
    public void testUnknownHost() throws URISyntaxException {
        ClientConfig config = new ClientConfig().property(ClientProperties.CONNECT_TIMEOUT, 1000);
        config.connectorProvider(new JettyConnectorProvider());
        Client c = ClientBuilder.newClient(config);
        final URI u = new URI("http://google.com:81");
        WebTarget target = c.target(u);
        try {
            target.request().get();
View Full Code Here

            // OK
        }
    }

    private Client getJettyClient() {
        return ClientBuilder.newClient(new ClientConfig().connectorProvider(new JettyConnectorProvider()));
    }
View Full Code Here

    protected Application configure() {
        return new ResourceConfig(HttpMethodResource.class, ErrorResource.class);
    }

    protected Client createClient() {
        ClientConfig cc = new ClientConfig();
        cc.connectorProvider(new ApacheConnectorProvider());
        return ClientBuilder.newClient(cc);
    }
View Full Code Here

        cc.connectorProvider(new ApacheConnectorProvider());
        return ClientBuilder.newClient(cc);
    }

    protected Client createPoolingClient() {
        ClientConfig cc = new ClientConfig();
        PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
        connectionManager.setMaxTotal(100);
        connectionManager.setDefaultMaxPerRoute(100);
        cc.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager);
        cc.connectorProvider(new ApacheConnectorProvider());
        return ClientBuilder.newClient(cc);
    }
View Full Code Here

        cr.close();
    }

    @Test
    public void testPostChunked() {
        ClientConfig cc = new ClientConfig()
                .property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024)
                .connectorProvider(new ApacheConnectorProvider());
        Client client = ClientBuilder.newClient(cc);
        WebTarget r = getWebTarget(client);
View Full Code Here

                .trustStoreBytes(ByteStreams.toByteArray(trustStore))
                .trustStorePassword("asdfgh")
                .keyStoreBytes(ByteStreams.toByteArray(keyStore))
                .keyPassword("asdfgh");

        ClientConfig cc = new ClientConfig();
        cc.property(ApacheClientProperties.SSL_CONFIG, sslConfig);
        cc.connectorProvider(new ApacheConnectorProvider());

        Client client = ClientBuilder.newClient(cc);
        // client basic auth demonstration
        client.register(HttpAuthenticationFeature.basic("user", "password"));
View Full Code Here

                .trustStorePassword("asdfgh")
                .keyStoreBytes(ByteStreams.toByteArray(keyStore))
                .keyPassword("asdfgh");


        ClientConfig cc = new ClientConfig();
        cc.property(ApacheClientProperties.SSL_CONFIG, sslConfig);
        cc.connectorProvider(new ApacheConnectorProvider());

        Client client = ClientBuilder.newClient(cc);

        System.out.println("Client: GET " + Server.BASE_URI);
View Full Code Here

        final InputStream trustStore = MainTest.class.getResourceAsStream("/truststore_client");
        SslConfigurator sslConfig = SslConfigurator.newInstance()
                .trustStoreBytes(ByteStreams.toByteArray(trustStore))
                .trustStorePassword("asdfgh");

        ClientConfig cc = new ClientConfig();
        cc.property(ApacheClientProperties.SSL_CONFIG, sslConfig);
        cc.connectorProvider(new ApacheConnectorProvider());

        Client client = ClientBuilder.newClient(cc);

        System.out.println("Client: GET " + Server.BASE_URI);
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.client.ClientConfig

Copyright © 2018 www.massapicom. 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.