Package org.apache.http.impl.client

Examples of org.apache.http.impl.client.BasicCookieStore


    public static final String COUNT = "count";

    @Test
    public void inMemorySessionTest() throws IOException {
        TestHttpClient client = new TestHttpClient();
        client.setCookieStore(new BasicCookieStore());
        try {
            final SessionCookieConfig sessionConfig = new SessionCookieConfig();
            final SessionAttachmentHandler handler = new SessionAttachmentHandler(new InMemorySessionManager(""), sessionConfig);
            handler.setNext(new HttpHandler() {
                @Override
View Full Code Here


    @Test
    public void inMemoryMaxSessionsTest() throws IOException {

        TestHttpClient client1 = new TestHttpClient();
        client1.setCookieStore(new BasicCookieStore());
        TestHttpClient client2 = new TestHttpClient();
        client2.setCookieStore(new BasicCookieStore());

        try {
            final SessionCookieConfig sessionConfig = new SessionCookieConfig();
            final SessionAttachmentHandler handler = new SessionAttachmentHandler(new InMemorySessionManager("", 1), sessionConfig);
            handler.setNext(new HttpHandler() {
View Full Code Here

    @Test
    public void testSsoSuccess() throws IOException {

        TestHttpClient client = new TestHttpClient();
        client.setCookieStore(new BasicCookieStore());
        HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/test1");
        HttpResponse result = client.execute(get);
        assertEquals(StatusCodes.UNAUTHORIZED, result.getStatusLine().getStatusCode());
        Header[] values = result.getHeaders(WWW_AUTHENTICATE.toString());
        String header = getAuthHeader(BASIC, values);
View Full Code Here

    }

    @Test
    public void testURLRewriting() throws IOException {
        TestHttpClient client = new TestHttpClient();
        client.setCookieStore(new BasicCookieStore());
        try {
            HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/notamatchingpath");
            HttpResponse result = client.execute(get);
            Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
            String url = HttpClientUtils.readResponse(result);
View Full Code Here

    }

    @Test
    public void testURLRewritingWithQueryParameters() throws IOException {
        TestHttpClient client = new TestHttpClient();
        client.setCookieStore(new BasicCookieStore());
        try {
            HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/notamatchingpath?a=b");
            HttpResponse result = client.execute(get);
            Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
            String url = HttpClientUtils.readResponse(result);
View Full Code Here

        params.removeParameter("User-Agent");
        params.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BEST_MATCH);
        // HttpConnectionParams.setConnectionTimeout(params, 150000);
        // HttpConnectionParams.setSoTimeout(params, socketTimeoutMillis);
        httpClient = new DefaultHttpClient(params);
        cookieStore = new BasicCookieStore();
        localContext = new BasicHttpContext();
        localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
    }
View Full Code Here

                        .maxConnectionPoolTimeout(3000)
                        .maxTotalConnections(500)
                        .pooledConnections()
                        .socketBufferSize(8192)
                        .socketTimeout(5000)
                        .cookieStore(new BasicCookieStore())
                        .build();
        HttpClient hc = client.getHttpClient();
    }
View Full Code Here

        assertNotNull(J4pClient.maxTotalConnections(100));
        assertNotNull(J4pClient.singleConnection());
        assertNotNull(J4pClient.pooledConnections());
        assertNotNull(J4pClient.socketBufferSize(8192));
        assertNotNull(J4pClient.socketTimeout(5000));
        assertNotNull(J4pClient.cookieStore(new BasicCookieStore()));
    }
View Full Code Here

    public void testRedirectWithCookie() throws Exception {
        final HttpHost target = getServerHttp();

        this.localServer.register("*", new BasicRedirectService());

        final CookieStore cookieStore = new BasicCookieStore();

        final BasicClientCookie cookie = new BasicClientCookie("name", "value");
        cookie.setDomain(target.getHostName());
        cookie.setPath("/");

        cookieStore.addCookie(cookie);

        final HttpClientContext context = HttpClientContext.create();
        context.setCookieStore(cookieStore);
        final HttpGet httpget = new HttpGet("/oldlocation/");

View Full Code Here

    protected AuthenticationStrategy createProxyAuthenticationStrategy() {
        return new ProxyAuthenticationStrategy();
    }

    protected CookieStore createCookieStore() {
        return new BasicCookieStore();
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.BasicCookieStore

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.