Http2TestUtil Class — netty Architecture
Architecture documentation for the Http2TestUtil class in Http2TestUtil.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6a8a567c_977e_e3a6_f305_671f38945583["Http2TestUtil"] 945883ee_c685_faa4_5503_879b96c1a6d1["Http2TestUtil.java"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|defined in| 945883ee_c685_faa4_5503_879b96c1a6d1 7d1b173d_a0ea_e1d9_ca25_3e6e0aaa9de9["runInChannel()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| 7d1b173d_a0ea_e1d9_ca25_3e6e0aaa9de9 488bb8cf_31d2_b7cf_bf01_994b97f69358["randomBytes()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| 488bb8cf_31d2_b7cf_bf01_994b97f69358 c246b11b_47f9_b530_5328_2ada73434686["AsciiString()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| c246b11b_47f9_b530_5328_2ada73434686 b6f2c1b0_9f48_3026_1563_49ff94bd0bb8["CharSequence()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| b6f2c1b0_9f48_3026_1563_49ff94bd0bb8 ae47fc50_e938_617d_7570_985ca8d76526["HpackEncoder()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| ae47fc50_e938_617d_7570_985ca8d76526 9eee5dd8_09e1_f0ff_c8d1_2c75a9663408["HpackDecoder()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| 9eee5dd8_09e1_f0ff_c8d1_2c75a9663408 fb6af8fc_e903_98e9_bbf7_4fdce4e321e4["Http2TestUtil()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| fb6af8fc_e903_98e9_bbf7_4fdce4e321e4 eadb4188_9221_af6d_f14a_53fc875c5959["ChannelPromise()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| eadb4188_9221_af6d_f14a_53fc875c5959 a9dc5128_5bd2_2311_a95f_0c6192c315d3["Http2FrameWriter()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| a9dc5128_5bd2_2311_a95f_0c6192c315d3 e5a7241a_da0a_32af_e10f_db8bc496be78["Http2Settings()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| e5a7241a_da0a_32af_e10f_db8bc496be78 36c8f103_b088_ab40_caf2_f46f910ae4e2["ByteBuf()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| 36c8f103_b088_ab40_caf2_f46f910ae4e2 bf946025_9034_0611_2e59_8d115603bd03["assertEqualsAndRelease()"] 6a8a567c_977e_e3a6_f305_671f38945583 -->|method| bf946025_9034_0611_2e59_8d115603bd03
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2TestUtil.java lines 59–538
public final class Http2TestUtil {
/**
* Interface that allows for running a operation that throws a {@link Http2Exception}.
*/
interface Http2Runnable {
void run() throws Http2Exception;
}
/**
* Runs the given operation within the event loop thread of the given {@link Channel}.
*/
static void runInChannel(Channel channel, final Http2Runnable runnable) {
channel.eventLoop().execute(new Runnable() {
@Override
public void run() {
try {
runnable.run();
} catch (Http2Exception e) {
throw new RuntimeException(e);
}
}
});
}
/**
* Returns a byte array filled with random data.
*/
public static byte[] randomBytes() {
return randomBytes(100);
}
/**
* Returns a byte array filled with random data.
*/
public static byte[] randomBytes(int size) {
byte[] data = new byte[size];
new Random().nextBytes(data);
return data;
}
/**
* Returns an {@link AsciiString} that wraps a randomly-filled byte array.
*/
public static AsciiString randomString() {
return new AsciiString(randomBytes());
}
public static CharSequence of(String s) {
return s;
}
public static HpackEncoder newTestEncoder() {
try {
return newTestEncoder(true, MAX_HEADER_LIST_SIZE, MAX_HEADER_TABLE_SIZE);
} catch (Http2Exception e) {
throw new Error("max size not allowed?", e);
}
}
public static HpackEncoder newTestEncoder(boolean ignoreMaxHeaderListSize,
long maxHeaderListSize, long maxHeaderTableSize) throws Http2Exception {
HpackEncoder hpackEncoder = new HpackEncoder(false, 16, 0);
ByteBuf buf = Unpooled.buffer();
try {
hpackEncoder.setMaxHeaderTableSize(buf, maxHeaderTableSize);
hpackEncoder.setMaxHeaderListSize(maxHeaderListSize);
} finally {
buf.release();
}
return hpackEncoder;
}
public static HpackDecoder newTestDecoder() {
try {
return newTestDecoder(MAX_HEADER_LIST_SIZE, MAX_HEADER_TABLE_SIZE);
} catch (Http2Exception e) {
throw new Error("max size not allowed?", e);
}
}
public static HpackDecoder newTestDecoder(long maxHeaderListSize, long maxHeaderTableSize) throws Http2Exception {
Source
Frequently Asked Questions
What is the Http2TestUtil class?
Http2TestUtil is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2TestUtil.java.
Where is Http2TestUtil defined?
Http2TestUtil is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2TestUtil.java at line 59.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free