DefaultProxyConnectProtocol extends AbstractProxyProtocol<ProxyConnectProtocolParser> implements ProxyConnectProtocol { @Override public void addCompression(CompressAlgorithm algorithm) { removeCompressOptionIfExist(); DefaultProxyContentParser contentParser = new DefaultProxyContentParser(); CompressParser compressParser = new CompressParser().setAlgorithm(algorithm); contentParser.setType(ProxyContentParser.ContentType.COMPRESS).setSubOptionParser(compressParser); getParser().addProxyOptionParser(contentParser); } DefaultProxyConnectProtocol(ProxyConnectProtocolParser parser); @Override List<ProxyEndpoint> nextEndpoints(); @Override void recordForwardFor(InetSocketAddress address); @Override String getForwardFor(); @Override void setContent(String content); @Override String getContent(); @Override String getRouteInfo(); @Override String getFinalStation(); @Override String getSource(); @Override boolean isCompressed(); @Override CompressAlgorithm getCompressAlgorithm(); @Override void removeCompressOptionIfExist(); @Override void addCompression(CompressAlgorithm algorithm); @Override String toString();  }
@Test public void testAddCompression() { Assert.assertFalse(protocol.isCompressed()); protocol.addCompression(new CompressAlgorithm() { @Override public String version() { return "3.0"; } @Override public AlgorithmType getType() { return AlgorithmType.ZSTD; } }); Assert.assertTrue(protocol.isCompressed()); Assert.assertEquals("3.0", protocol.getCompressAlgorithm().version()); Assert.assertEquals(CompressAlgorithm.AlgorithmType.ZSTD, protocol.getCompressAlgorithm().getType()); }