Ejemplo n.º 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));
  }
Ejemplo n.º 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)));
 }
Ejemplo n.º 3
0
 private void assertSameInputStream(final Entity entity) {
   assertThat(entity.inputStream(), sameInstance(entity.inputStream()));
 }