Example #1
0
  @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));
  }
Example #2
0
 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)));
 }
Example #3
0
 private void assertSameInputStream(final Entity entity) {
   assertThat(entity.inputStream(), sameInstance(entity.inputStream()));
 }