testEncodingSingleCookieV0() — netty Function Reference
Architecture documentation for the testEncodingSingleCookieV0() function in ServerCookieEncoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2eef5372_fa00_c5e1_002f_8e06849438b1["testEncodingSingleCookieV0()"] 8f5d85cb_9261_ef89_d9fb_1265f8ca3574["ServerCookieEncoderTest"] 2eef5372_fa00_c5e1_002f_8e06849438b1 -->|defined in| 8f5d85cb_9261_ef89_d9fb_1265f8ca3574 style 2eef5372_fa00_c5e1_002f_8e06849438b1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/cookie/ServerCookieEncoderTest.java lines 40–63
@Test
public void testEncodingSingleCookieV0() throws ParseException {
int maxAge = 50;
String result = "myCookie=myValue; Max-Age=50; Expires=(.+?); Path=/apathsomewhere;" +
" Domain=.adomainsomewhere; Secure; SameSite=Lax; Partitioned";
DefaultCookie cookie = new DefaultCookie("myCookie", "myValue");
cookie.setDomain(".adomainsomewhere");
cookie.setMaxAge(maxAge);
cookie.setPath("/apathsomewhere");
cookie.setSecure(true);
cookie.setSameSite(SameSite.Lax);
cookie.setPartitioned(true);
String encodedCookie = ServerCookieEncoder.STRICT.encode(cookie);
Matcher matcher = Pattern.compile(result).matcher(encodedCookie);
assertTrue(matcher.find());
Date expiresDate = DateFormatter.parseHttpDate(matcher.group(1));
long diff = (expiresDate.getTime() - System.currentTimeMillis()) / 1000;
// 2 secs should be fine
assertTrue(Math.abs(diff - maxAge) <= 2);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testEncodingSingleCookieV0() do?
testEncodingSingleCookieV0() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/cookie/ServerCookieEncoderTest.java.
Where is testEncodingSingleCookieV0() defined?
testEncodingSingleCookieV0() is defined in codec-http/src/test/java/io/netty/handler/codec/http/cookie/ServerCookieEncoderTest.java at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free