GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Auto-port 4.1: Stabilize testSessionInvalidate for Conscrypt (#16616) · netty/netty@7c02257

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handler/src/test/java/io/netty/handler/ssl
    • SSLEngineTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java‎

Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java
+43-37Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,7 @@ public void testSessionInvalidate(SSLEngineTestParam param) throws Exception {
13761376
clientEngine = wrapEngine(clientSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
13771377
serverEngine = wrapEngine(serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
13781378
handshake(param.type(), param.delegate(), clientEngine, serverEngine);
1379+
pingPongPacketsUntilSessionAllocation(param, clientEngine, serverEngine);
13791380

13801381
SSLSession session = serverEngine.getSession();
13811382
assertTrue(session.isValid(), "session should be valid: " + session);
@@ -1417,43 +1418,7 @@ public void testSSLSessionId(SSLEngineTestParam param) throws Exception {
14171418
handshake(param.type(), param.delegate(), clientEngine, serverEngine);
14181419

14191420
if (param.protocolCipherCombo == ProtocolCipherCombo.TLSV13) {
1420-
// Allocate something which is big enough for sure
1421-
ByteBuffer packetBuffer = allocateBuffer(param.type(), 32 * 1024);
1422-
ByteBuffer appBuffer = allocateBuffer(param.type(), 32 * 1024);
1423-
1424-
appBuffer.clear().position(4).flip();
1425-
packetBuffer.clear();
1426-
1427-
do {
1428-
SSLEngineResult result;
1429-
1430-
do {
1431-
result = serverEngine.wrap(appBuffer, packetBuffer);
1432-
} while (appBuffer.hasRemaining() || result.bytesProduced() > 0);
1433-
1434-
appBuffer.clear();
1435-
packetBuffer.flip();
1436-
do {
1437-
result = clientEngine.unwrap(packetBuffer, appBuffer);
1438-
} while (packetBuffer.hasRemaining() || result.bytesProduced() > 0);
1439-
1440-
packetBuffer.clear();
1441-
appBuffer.clear().position(4).flip();
1442-
1443-
do {
1444-
result = clientEngine.wrap(appBuffer, packetBuffer);
1445-
} while (appBuffer.hasRemaining() || result.bytesProduced() > 0);
1446-
1447-
appBuffer.clear();
1448-
packetBuffer.flip();
1449-
1450-
do {
1451-
result = serverEngine.unwrap(packetBuffer, appBuffer);
1452-
} while (packetBuffer.hasRemaining() || result.bytesProduced() > 0);
1453-
1454-
packetBuffer.clear();
1455-
appBuffer.clear().position(4).flip();
1456-
} while (clientEngine.getSession().getId().length == 0);
1421+
pingPongPacketsUntilSessionAllocation(param, clientEngine, serverEngine);
14571422

14581423
// With TLS1.3 we should see pseudo IDs and so these should never match.
14591424
assertFalse(Arrays.equals(clientEngine.getSession().getId(), serverEngine.getSession().getId()));
@@ -1472,6 +1437,47 @@ public void testSSLSessionId(SSLEngineTestParam param) throws Exception {
14721437
}
14731438
}
14741439

1440+
private void pingPongPacketsUntilSessionAllocation(
1441+
SSLEngineTestParam param, SSLEngine clientEngine, SSLEngine serverEngine) throws SSLException {
1442+
// Allocate something which is big enough for sure
1443+
ByteBuffer packetBuffer = allocateBuffer(param.type(), 32 * 1024);
1444+
ByteBuffer appBuffer = allocateBuffer(param.type(), 32 * 1024);
1445+
1446+
appBuffer.clear().position(4).flip();
1447+
packetBuffer.clear();
1448+
1449+
do {
1450+
SSLEngineResult result;
1451+
1452+
do {
1453+
result = serverEngine.wrap(appBuffer, packetBuffer);
1454+
} while (appBuffer.hasRemaining() || result.bytesProduced() > 0);
1455+
1456+
appBuffer.clear();
1457+
packetBuffer.flip();
1458+
do {
1459+
result = clientEngine.unwrap(packetBuffer, appBuffer);
1460+
} while (packetBuffer.hasRemaining() || result.bytesProduced() > 0);
1461+
1462+
packetBuffer.clear();
1463+
appBuffer.clear().position(4).flip();
1464+
1465+
do {
1466+
result = clientEngine.wrap(appBuffer, packetBuffer);
1467+
} while (appBuffer.hasRemaining() || result.bytesProduced() > 0);
1468+
1469+
appBuffer.clear();
1470+
packetBuffer.flip();
1471+
1472+
do {
1473+
result = serverEngine.unwrap(packetBuffer, appBuffer);
1474+
} while (packetBuffer.hasRemaining() || result.bytesProduced() > 0);
1475+
1476+
packetBuffer.clear();
1477+
appBuffer.clear().position(4).flip();
1478+
} while (clientEngine.getSession().getId().length == 0);
1479+
}
1480+
14751481
@MethodSource("newTestParams")
14761482
@ParameterizedTest
14771483
@Timeout(30)

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.