-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/test/java/io/vertx/core/http/Http1xZstdCompressionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.vertx.core.http; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import io.netty.handler.codec.MessageToByteEncoder; | ||
import io.netty.handler.codec.compression.StandardCompressionOptions; | ||
import io.netty.handler.codec.compression.Zstd; | ||
import io.netty.handler.codec.compression.ZstdEncoder; | ||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
|
||
|
||
public class Http1xZstdCompressionTest extends HttpCompressionTestBase { | ||
|
||
@BeforeClass | ||
public static void zstdLibraryIsAvailable() { | ||
Assert.assertTrue(Zstd.isAvailable()); | ||
} | ||
|
||
@Override | ||
protected HttpServerOptions createBaseServerOptions() { | ||
return new HttpServerOptions().setPort(DEFAULT_HTTP_PORT).setHost(DEFAULT_HTTP_HOST); | ||
} | ||
|
||
@Override | ||
protected HttpClientOptions createBaseClientOptions() { | ||
return new HttpClientOptions().setDefaultPort(DEFAULT_HTTP_PORT).setDefaultHost(DEFAULT_HTTP_HOST); | ||
} | ||
|
||
@Override | ||
protected MessageToByteEncoder<ByteBuf> encoder() { | ||
return new ZstdEncoder(); | ||
} | ||
|
||
@Override | ||
protected String encoding() { | ||
return "zstd"; | ||
} | ||
|
||
@Override | ||
protected void configureServerCompression(HttpServerOptions options) { | ||
options.setCompressionSupported(true).addCompressor(StandardCompressionOptions.zstd()); | ||
} | ||
} |