### Question:
RequestFromVertx extends Request { @Override public MediaType mediaType() { Collection<MediaType> types = mediaTypes(); if (types == null || types.isEmpty()) { return MediaType.ANY_TEXT_TYPE; } else if (types.size() == 1 && types.iterator().next().equals(MediaType.ANY_TYPE)) { return MediaType.ANY_TEXT_TYPE; } else { return types.iterator().next(); } } RequestFromVertx(final HttpServerRequest request); @Override String contentType(); @Override String encoding(); @Override String language(); @Override String charset(); @Override String uri(); @Override String method(); @Override String remoteAddress(); @Override String host(); @Override String path(); @Override MediaType mediaType(); @Override Collection<MediaType> mediaTypes(); @Override boolean accepts(String mimeType); @Override Cookies cookies(); Cookie cookie(String name); @Override Map<String, List<String>> headers(); @Override String parameter(String name); @Override List<String> parameterMultipleValues(String name); @Override String parameter(String name, String defaultValue); @Override Integer parameterAsInteger(String name); @Override Integer parameterAsInteger(String name, Integer defaultValue); @Override Boolean parameterAsBoolean(String name); @Override Boolean parameterAsBoolean(String name, boolean defaultValue); @Override Map<String, List<String>> parameters(); @Override Map<String, Object> data(); HttpServerRequest getVertxRequest(); Map<String, List<String>> getFormData(); String getRawBodyAsString(); byte[] getRawBody(); List<VertxFileUpload> getFiles(); boolean ready();  }### Answer:
@Test public void testMediaType() throws Exception { HttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/"); req.headers().set(HeaderNames.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," + "**;q=0.8"); assertThat(request.mediaType().toString()).isEqualTo("application/xhtml+xml"); req.headers().set(HeaderNames.ACCEPT, "application/xhtml+xml;q=0.1,application/xml;q=0.9;charset=utf-8,**"); assertThat(request.mediaType()).isEqualTo(MediaType.ANY_TEXT_TYPE); req.headers().set(HeaderNames.ACCEPT, "text*;q=0.5"); assertThat(request.mediaTypes()).containsExactly( MediaType.parse("text/html").withParameter("level", "1"), MediaType.parse("text/html").withParameter("q", "0.7"), MediaType.parse("*/*").withParameter("q", "0.5"), MediaType.parse("text/html").withParameter("level", "2").withParameter("q", "0.4"), MediaType.parse("text/*").withParameter("q", "0.3") ); }