func runBeginSessionTests()

in cmd/conformance/main.go [999:1046]


func runBeginSessionTests(ctx context.Context) {
	beginSessionTestCases := []beginSessionTest{
		{
			testName:  "Valid request with proper TLS Client Hello",
			expectErr: false,
		},
		{
			testName:  "Malformed Client Hello in request",
			expectErr: true,
			mutateTLSRecords: func(r []byte) []byte {
				r[5] = 0xFF // Client Hello byte should be 0x01
				return r
			},
		},
		{
			testName:         "No TLS records in request",
			expectErr:        true,
			mutateTLSRecords: emptyFn,
		},
		{
			testName:        "Invalid cipher suite",
			expectErr:       true,
			altCipherSuites: []uint16{tls.TLS_RSA_WITH_AES_256_GCM_SHA384},
		},
		{
			testName:  "JWT has invalid signature",
			expectErr: true,
			mutateJWT: invalidateJwtSignature,
			optional:  true,
		},
		{
			testName:  "JWT has a bad audience",
			expectErr: true,
			mutateJWT: badAudience,
			optional:  true,
		},
	}

	for _, testCase := range beginSessionTestCases {
		err := runBeginSessionTestCase(ctx, testCase)
		testPassed := testCase.expectErr == (err != nil)
		if testPassed {
			colour.Printf(" - ^2%v^R\n", testCase.testName)
		} else {
			printError(testCase.testName, err, testCase.optional)
		}
	}
}