further jackson work - ignroing new fields, and some httpclient cookie work
This commit is contained in:
@@ -69,6 +69,7 @@ public class HttpClientCookieLiveTest {
|
||||
final BasicCookieStore cookieStore = new BasicCookieStore();
|
||||
final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234");
|
||||
cookie.setDomain(".github.com");
|
||||
cookie.setPath("/");
|
||||
cookieStore.addCookie(cookie);
|
||||
final DefaultHttpClient client = new DefaultHttpClient();
|
||||
client.setCookieStore(cookieStore);
|
||||
@@ -85,6 +86,7 @@ public class HttpClientCookieLiveTest {
|
||||
final BasicCookieStore cookieStore = new BasicCookieStore();
|
||||
final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234");
|
||||
cookie.setDomain(".github.com");
|
||||
cookie.setPath("/");
|
||||
cookieStore.addCookie(cookie);
|
||||
instance = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
|
||||
|
||||
@@ -100,6 +102,7 @@ public class HttpClientCookieLiveTest {
|
||||
final BasicCookieStore cookieStore = new BasicCookieStore();
|
||||
final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234");
|
||||
cookie.setDomain(".github.com");
|
||||
cookie.setPath("/");
|
||||
cookieStore.addCookie(cookie);
|
||||
instance = HttpClientBuilder.create().build();
|
||||
|
||||
@@ -107,6 +110,7 @@ public class HttpClientCookieLiveTest {
|
||||
|
||||
final HttpContext localContext = new BasicHttpContext();
|
||||
localContext.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
|
||||
// localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); // before 4.3
|
||||
response = instance.execute(request, localContext);
|
||||
|
||||
assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
|
||||
|
||||
@@ -157,4 +157,30 @@ public class HttpClientLiveTest {
|
||||
response = instance.execute(new HttpGet(SAMPLE_URL));
|
||||
}
|
||||
|
||||
// tests - cancel request
|
||||
|
||||
@Test
|
||||
public final void whenRequestIsCanceled_thenCorrect() throws ClientProtocolException, IOException {
|
||||
instance = HttpClients.custom().build();
|
||||
final HttpGet request = new HttpGet(SAMPLE_URL);
|
||||
response = instance.execute(request);
|
||||
|
||||
try {
|
||||
final HttpEntity entity = response.getEntity();
|
||||
|
||||
System.out.println("----------------------------------------");
|
||||
System.out.println(response.getStatusLine());
|
||||
if (entity != null) {
|
||||
System.out.println("Response content length: " + entity.getContentLength());
|
||||
}
|
||||
System.out.println("----------------------------------------");
|
||||
|
||||
// Do not feel like reading the response body
|
||||
// Call abort on the request object
|
||||
request.abort();
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user