@Test public void canClose() throws Exception { Entity entity = entity(countClose()); assertThat(entity.inputStream().read(), CoreMatchers.is(0)); entity.close(); assertThat(entity.inputStream().read(), CoreMatchers.is(1)); }
default Request form(Iterable<? extends Pair<String, String>> parameters) { return header( CONTENT_TYPE, format("%s; charset=%s", APPLICATION_FORM_URLENCODED, DEFAULT_CHARACTER_SET)) .entity(Entity.entity(UrlEncodedMessage.toString(parameters))); }
private void assertSameInputStream(final Entity entity) { assertThat(entity.inputStream(), sameInstance(entity.inputStream())); }