File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
test/InMemory.FunctionalTests Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,12 @@ private static ClientHelloParseState TryParseClientHello(ReadOnlySequence<byte>
114114 return ClientHelloParseState . NotTlsClientHello ;
115115 }
116116
117+ // byte 6: handshake message type (must be 0x01 for ClientHello)
118+ if ( ! reader . TryRead ( out byte handshakeType ) || handshakeType != 0x01 )
119+ {
120+ return ClientHelloParseState . NotTlsClientHello ;
121+ }
122+
117123 // 5 bytes are
118124 // 1) Handshake (1 byte)
119125 // 2) Protocol version (2 bytes)
@@ -123,12 +129,6 @@ private static ClientHelloParseState TryParseClientHello(ReadOnlySequence<byte>
123129 return ClientHelloParseState . NotEnoughData ;
124130 }
125131
126- // byte 6: handshake message type (must be 0x01 for ClientHello)
127- if ( ! reader . TryRead ( out byte handshakeType ) || handshakeType != 0x01 )
128- {
129- return ClientHelloParseState . NotTlsClientHello ;
130- }
131-
132132 clientHelloBytes = buffer . Slice ( 0 , 5 + recordLength ) ;
133133 return ClientHelloParseState . ValidTlsClientHello ;
134134 }
Original file line number Diff line number Diff line change @@ -79,13 +79,8 @@ public async Task RunTlsClientHelloCallbackTest_DeterministinglyReads()
7979
8080 await transportConnection . Input . WriteAsync ( new byte [ 1 ] { 0x16 } ) ;
8181 var middlewareTask = Task . Run ( ( ) => middleware . OnTlsClientHelloAsync ( transportConnection ) ) ;
82- await Task . Delay ( TimeSpan . FromMilliseconds ( 75 ) ) ;
83-
8482 await transportConnection . Input . WriteAsync ( new byte [ 2 ] { 0x03 , 0x01 } ) ;
85- await Task . Delay ( TimeSpan . FromMilliseconds ( 75 ) ) ;
86-
8783 await transportConnection . Input . WriteAsync ( new byte [ 2 ] { 0x00 , 0x20 } ) ;
88- await Task . Delay ( TimeSpan . FromMilliseconds ( 75 ) ) ;
8984
9085 await transportConnection . Input . CompleteAsync ( ) ;
9186
@@ -96,7 +91,8 @@ public async Task RunTlsClientHelloCallbackTest_DeterministinglyReads()
9691 // ensuring that we have read limited number of times
9792 var observableTransport = transportConnection . Transport as ObservableDuplexPipe ;
9893 Assert . NotNull ( observableTransport ) ;
99- Assert . True ( observableTransport . ReadAsyncCounter is > 2 && observableTransport . ReadAsyncCounter is <= 5 ) ;
94+ Assert . True ( observableTransport . ReadAsyncCounter is >= 2 && observableTransport . ReadAsyncCounter is <= 5 ,
95+ $ "Expected ReadAsync() to happen about 2-5 times. Actually happened { observableTransport . ReadAsyncCounter } times.") ;
10096 }
10197
10298 private async Task RunTlsClientHelloCallbackTest_WithMultipleSegments (
You can’t perform that action at this time.
0 commit comments