Package org.apache.wink.client

Examples of org.apache.wink.client.ClientConfig


        config.readTimeout(20000);
        return new RestClient(config);
    }

    public RestClient getConnectTimeoutClient() {
        ClientConfig config = new ClientConfig();
        config.connectTimeout(20000);
        return new RestClient(config);
    }
View Full Code Here


    @Override
    public void setUp() throws Exception {
        super.setUp();
        client =
            new RestClient(new ClientConfig().acceptHeaderAutoSet(false)
                .applications(new Application() {

                    @Override
                    public Set<Class<?>> getClasses() {
                        Set<Class<?>> classes = new HashSet<Class<?>>();
View Full Code Here

*/
public class AcceptHeaderHandlerApacheHTTPCoreTest extends AcceptHeaderHandlerTest {

    public void setUp() throws Exception {
        super.setUp();
        ClientConfig config = new ApacheHttpClientConfig();
//        config.setLoadWinkApplications(false);
        config.applications(new Application() {

            @Override
            public Set<Class<?>> getClasses() {
                Set<Class<?>> classes = new HashSet<Class<?>>();
                classes.add(JsonProvider.class);
View Full Code Here

    RestClient client = null;

    public void setUp() throws Exception {
        super.setUp();

        ClientConfig config = new ApacheHttpClientConfig();
//        config.setLoadWinkApplications(false);
        config.applications(new Application() {

            @Override
            public Set<Class<?>> getClasses() {
                Set<Class<?>> classes = new HashSet<Class<?>>();
                classes.add(JsonProvider.class);
View Full Code Here

     */
   
    // basic auth handler should throw exception when challenged but no username is set
    public void testNoUserNameBasicAuthFailure() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(401);
        ClientConfig config = new ClientConfig();
        BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler();
        // oops, forgot to set username!
        basicAuthSecurityHandler.setPassword("password");
        config.handlers(basicAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
View Full Code Here

    }
   
    // basic auth handler should throw exception when challenged but no password is set
    public void testNoPasswordBasicAuthFailure() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(401);
        ClientConfig config = new ClientConfig();
        BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler();
        basicAuthSecurityHandler.setUserName("username");
        // oops, forgot to set password!
        config.handlers(basicAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
View Full Code Here

    }
   
    // basic auth handler should flow through when NOT challenged but no username is set
    public void testNoUserNameBasicAuthAllowed() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(200);
        ClientConfig config = new ClientConfig();
        BasicAuthSecurityHandler basicAuthSecurityHandler = new BasicAuthSecurityHandler();
        // oops, forgot to set username!
        basicAuthSecurityHandler.setPassword("password");
        config.handlers(basicAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

    }
   
    // proxy auth handler should throw exception when challenged but no username is set
    public void testNoUserNameProxyAuthFailure() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(407);
        ClientConfig config = new ClientConfig();
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        // oops, forgot to set username!
        proxyAuthSecurityHandler.setPassword("password");
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
View Full Code Here

    }
   
    // proxy auth handler should throw exception when challenged but no password is set
    public void testNoPasswordProxyAuthFailure() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(407);
        ClientConfig config = new ClientConfig();
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        proxyAuthSecurityHandler.setUserName("username");
        // oops, forgot to set password!
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        try {
            @SuppressWarnings("unused")
            ClientResponse response = resource.get();
View Full Code Here

    }
   
    // proxy auth handler should flow through when NOT challenged but no username is set
    public void testNoUserNameProxyAuthAllowed() throws Exception {
        server.getMockHttpServerResponses().get(0).setMockResponseCode(200);
        ClientConfig config = new ClientConfig();
        ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
        // oops, forgot to set username!
        proxyAuthSecurityHandler.setPassword("password");
        config.handlers(proxyAuthSecurityHandler);
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL);
        ClientResponse response = resource.get();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.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.