use of org.jsoup.Connection in project jsoup by jhy.
the class HttpConnectionTest method cookie.
@Test
public void cookie() {
Connection con = HttpConnection.connect("http://example.com/");
con.cookie("Name", "Val");
assertEquals("Val", con.request().cookie("Name"));
}
use of org.jsoup.Connection in project jsoup by jhy.
the class HttpConnectionTest method timeout.
@Test
public void timeout() {
Connection con = HttpConnection.connect("http://example.com/");
assertEquals(30 * 1000, con.request().timeout());
con.timeout(1000);
assertEquals(1000, con.request().timeout());
}
use of org.jsoup.Connection in project jsoup by jhy.
the class HttpConnectionTest method method.
@Test
public void method() {
Connection con = HttpConnection.connect("http://example.com/");
assertEquals(Connection.Method.GET, con.request().method());
con.method(Connection.Method.POST);
assertEquals(Connection.Method.POST, con.request().method());
}
use of org.jsoup.Connection in project jsoup by jhy.
the class HttpConnectionTest method requestBody.
@Test
public void requestBody() {
Connection con = HttpConnection.connect("http://example.com/");
con.requestBody("foo");
assertEquals("foo", con.request().requestBody());
}
use of org.jsoup.Connection in project jsoup by jhy.
the class HttpConnectionTest method throwsExceptionOnParseWithoutExecute.
/* most actual network http connection tests are in integration */
@Test(expected = IllegalArgumentException.class)
public void throwsExceptionOnParseWithoutExecute() throws IOException {
Connection con = HttpConnection.connect("http://example.com");
con.response().parse();
}
Aggregations