@Test public void iterableCloseIsPropagated() throws Exception { final FormUrlEncodedHttpDeserializer deserializer = FormUrlEncodedHttpDeserializer.UTF8; final HttpHeaders headers = DefaultHttpHeadersFactory.INSTANCE.newHeaders(); headers.set(CONTENT_TYPE, "application/x-www-form-urlencoded; charset=UTF-8"); final AtomicBoolean isClosed = new AtomicBoolean(false); final BlockingIterable<Buffer> formParametersIterable = () -> new BlockingIterator<Buffer>() { @Override public boolean hasNext(final long timeout, final TimeUnit unit) { return false; } @Override public Buffer next(final long timeout, final TimeUnit unit) { return EMPTY_BUFFER; } @Override public Buffer next() { return EMPTY_BUFFER; } @Override public void close() { isClosed.set(true); } @Override public boolean hasNext() { return false; } }; final BlockingIterable<Map<String, List<String>>> deserialized = deserializer .deserialize(headers, formParametersIterable); deserialized.iterator().close(); assertTrue("BlockingIterable was not closed.", isClosed.get()); }
@Override public Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload) { checkContentType(headers, checkContentType); return deserialize(payload); }
FormUrlEncodedHttpDeserializer implements HttpDeserializer<Map<String, List<String>>> { @Override public Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload) { checkContentType(headers, checkContentType); return deserialize(payload); } }
FormUrlEncodedHttpDeserializer implements HttpDeserializer<Map<String, List<String>>> { @Override public Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload) { checkContentType(headers, checkContentType); return deserialize(payload); } FormUrlEncodedHttpDeserializer(final Charset charset, final Predicate<HttpHeaders> checkContentType); }
FormUrlEncodedHttpDeserializer implements HttpDeserializer<Map<String, List<String>>> { @Override public Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload) { checkContentType(headers, checkContentType); return deserialize(payload); } FormUrlEncodedHttpDeserializer(final Charset charset, final Predicate<HttpHeaders> checkContentType); @Override Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload); @Override BlockingIterable<Map<String, List<String>>> deserialize(final HttpHeaders headers,
                                                                   final BlockingIterable<Buffer> payload); @Override Publisher<Map<String, List<String>>> deserialize(final HttpHeaders headers,
                                                            final Publisher<Buffer> payload); }
FormUrlEncodedHttpDeserializer implements HttpDeserializer<Map<String, List<String>>> { @Override public Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload) { checkContentType(headers, checkContentType); return deserialize(payload); } FormUrlEncodedHttpDeserializer(final Charset charset, final Predicate<HttpHeaders> checkContentType); @Override Map<String, List<String>> deserialize(final HttpHeaders headers, final Buffer payload); @Override BlockingIterable<Map<String, List<String>>> deserialize(final HttpHeaders headers,
                                                                   final BlockingIterable<Buffer> payload); @Override Publisher<Map<String, List<String>>> deserialize(final HttpHeaders headers,
                                                            final Publisher<Buffer> payload);  }