Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.PostMethod.releaseConnection()


        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }
    }

    /**
     * Tests POST via authenticating proxy + host auth + connection keep-alive
View Full Code Here


        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }
    }

    /**
     * Tests POST via authenticating proxy + host auth + connection close
View Full Code Here

        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }
    }

    /**
     * Tests POST via non-authenticating proxy + invalid host auth
View Full Code Here

        post.setRequestEntity(new StringRequestEntity("Like tons of stuff"));
        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_UNAUTHORIZED, post.getStatusCode());
        } finally {
            post.releaseConnection();
        }
    }

    /**
     * Tests POST via non-authenticating proxy + interactive host auth + connection keep-alive
View Full Code Here

        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }
    }

    /**
     * Tests POST via non-authenticating proxy + interactive host auth + connection close
View Full Code Here

        try {
            this.client.executeMethod(post);
            assertEquals(HttpStatus.SC_OK, post.getStatusCode());
            assertNotNull(post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }
    }

}
View Full Code Here

            this.client.executeMethod(httppost);
            assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, httppost.getStatusCode());
            assertEquals("/oldlocation/", httppost.getPath());
            assertEquals(new URI("/oldlocation/", false), httppost.getURI());
        } finally {
            httppost.releaseConnection();
        }
    }

    public void testRelativeRedirect() throws IOException {
        String host = this.server.getLocalAddress();
View Full Code Here

        post.setRequestEntity(new StringRequestEntity("Test body"));
        try {
            this.client.executeMethod(post);
            assertEquals("Test body", post.getResponseBodyAsString());
        } finally {
            post.releaseConnection();
        }
        assertNotNull(post.getStatusLine());
        assertEquals(HttpStatus.SC_OK, post.getStatusLine().getStatusCode());
        Header auth = post.getRequestHeader("Authorization");
        assertNotNull(auth);
View Full Code Here

        PostMethod httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
        assertFalse(connman.getConection().isOpen());

        httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("more stuff"));
View Full Code Here

        httppost = new PostMethod("/test/");
        httppost.setRequestEntity(new StringRequestEntity("more stuff"));
        try {
            this.client.executeMethod(httppost);
        } finally {
            httppost.releaseConnection();
        }
        assertFalse(connman.getConection().isOpen());
    }

    public void testConnPersisenceHTTP11() throws Exception {
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.