### Question:
HttpUtils { public static Charset extractContentTypeCharsetAttribute(String contentType) { String charsetName = extractContentTypeAttribute(contentType, CONTENT_TYPE_CHARSET_ATTRIBUTE); return charsetName != null ? Charset.forName(charsetName) : null; } private  HttpUtils(); static String hostHeader(Uri uri); static String originHeader(Uri uri); static Charset extractContentTypeCharsetAttribute(String contentType); static String extractContentTypeBoundaryAttribute(String contentType); static byte[] computeMultipartBoundary(); static String patchContentTypeWithBoundaryAttribute(CharSequence base, byte[] boundary); static boolean followRedirect(AsyncHttpClientConfig config, Request request); static ByteBuffer urlEncodeFormParams(List<Param> params, Charset charset); static CharSequence filterOutBrotliFromAcceptEncoding(String acceptEncoding); static final AsciiString ACCEPT_ALL_HEADER_VALUE; static final AsciiString GZIP_DEFLATE; }### Answer:
@Test public void testExtractCharsetWithoutQuotes() { Charset charset = HttpUtils.extractContentTypeCharsetAttribute("text/html; charset=iso-8859-1"); assertEquals(charset, ISO_8859_1); }
@Test public void testExtractCharsetWithSingleQuotes() { Charset charset = HttpUtils.extractContentTypeCharsetAttribute("text/html; charset='iso-8859-1'"); assertEquals(charset, ISO_8859_1); }
@Test public void testExtractCharsetWithDoubleQuotes() { Charset charset = HttpUtils.extractContentTypeCharsetAttribute("text/html; charset=\"iso-8859-1\""); assertEquals(charset, ISO_8859_1); }
@Test public void testExtractCharsetWithDoubleQuotesAndSpaces() { Charset charset = HttpUtils.extractContentTypeCharsetAttribute("text/html; charset= \"iso-8859-1\" "); assertEquals(charset, ISO_8859_1); }
@Test public void testExtractCharsetFallsBackToUtf8() { Charset charset = HttpUtils.extractContentTypeCharsetAttribute(APPLICATION_JSON.toString()); assertNull(charset); }