DefaultProxyContentParser implements ProxyOptionParser, ProxyContentParser { @Override public ProxyOptionParser read(String option) { String[] optionArr = StringUtil.splitRemoveEmpty(AbstractProxyOptionParser.WHITE_SPACE, option); subOptionParser = getSubOptionParser(optionArr[1]); String[] suboption; if(optionArr.length > 2) { suboption = new String[optionArr.length - 2]; System.arraycopy(optionArr, 2, suboption, 0, suboption.length); } else { suboption = new String[0]; } subOptionParser.parse(suboption); return this; }  @Override String output(); @Override ProxyOptionParser read(String option); @Override PROXY_OPTION option(); @Override boolean isImportant(); DefaultProxyContentParser setSubOptionParser(SubOptionParser subOptionParser); DefaultProxyContentParser setType(ContentType type); @Override SubOptionParser getSubOption(); @Override ContentType getContentType();  }
@Test public void testRead() { long time1 = System.nanoTime(); parser = (DefaultProxyContentParser) parser.read("CONTENT COMPRESS ZSTD 1.0"); long time2 = System.nanoTime(); ProxyContentParser.SubOptionParser subOptionParser = parser.getSubOption(); long time3 = System.nanoTime(); ProxyContentParser.ContentType type = parser.getContentType(); long time4 = System.nanoTime(); Assert.assertEquals(ProxyContentParser.ContentType.COMPRESS, type); long time5 = System.nanoTime(); Assert.assertTrue(subOptionParser instanceof CompressParser); long time6 = System.nanoTime(); logger.info("{}", time2 - time1); logger.info("{}", time3 - time2); logger.info("{}", time4 - time3); logger.info("{}", time5 - time4); logger.info("{}", time6 - time5); CompressParser compressParser = (CompressParser) subOptionParser; Assert.assertEquals(CompressAlgorithm.AlgorithmType.ZSTD, compressParser.getAlgorithm().getType()); Assert.assertEquals("1.0", compressParser.getAlgorithm().version()); }