HttpHeadersImpl implements HttpHeaders { @Override public Locale getLanguage() { String value = nettyHttpHeaders.get(HttpHeaders.CONTENT_LANGUAGE); return value == null ? null : new Locale(value.trim()); } HttpHeadersImpl(io.netty.handler.codec.http.HttpHeaders httpHeaders); @Override List<String> getRequestHeader(String name); @Override String getHeaderString(String name); @Override MultivaluedMap<String, String> getRequestHeaders(); @Override List<MediaType> getAcceptableMediaTypes(); @Override List<Locale> getAcceptableLanguages(); @Override MediaType getMediaType(); @Override Locale getLanguage(); @Override Map<String, Cookie> getCookies(); @Override Date getDate(); @Override int getLength();  }
@Test public void testGetLanguage() throws Exception { Locale locale = httpHeaders1.getLanguage(); assertNotNull(locale); assertEquals(locale.getLanguage(), "en"); Locale locale2 = httpHeaders2.getLanguage(); assertNull(locale2); }