@@ -54,35 +54,35 @@ describe('ProtocolHandshaker', () => {
5454 expect ( writtenBuffers [ 0 ] . toHex ( ) ) . toEqual ( `${ boltMagicPreamble } ${ protocolVersion2 } ${ protocolVersion1 } ${ noProtocolVersion } ${ noProtocolVersion } ` ) ;
5555 } ) ;
5656
57- it ( 'should read handshake response containing valid protocol version' , ( ) => {
57+ it ( 'should create protocol with valid version' , ( ) => {
5858 const handshaker = new ProtocolHandshaker ( null , null , null , false , Logger . noOp ( ) ) ;
5959
6060 // buffer with Bolt V1
6161 const buffer = handshakeResponse ( 1 ) ;
6262
63- const protocol = handshaker . readHandshakeResponse ( buffer ) ;
63+ const protocol = handshaker . createNegotiatedProtocol ( buffer ) ;
6464
6565 expect ( protocol ) . toBeDefined ( ) ;
6666 expect ( protocol ) . not . toBeNull ( ) ;
6767 expect ( protocol instanceof BoltProtocol ) . toBeTruthy ( ) ;
6868 } ) ;
6969
70- it ( 'should read handshake response containing invalid protocol version' , ( ) => {
70+ it ( 'should fail to create protocol from invalid version' , ( ) => {
7171 const handshaker = new ProtocolHandshaker ( null , null , null , false , Logger . noOp ( ) ) ;
7272
7373 // buffer with Bolt V42 which is invalid
7474 const buffer = handshakeResponse ( 42 ) ;
7575
76- expect ( ( ) => handshaker . readHandshakeResponse ( buffer ) ) . toThrow ( ) ;
76+ expect ( ( ) => handshaker . createNegotiatedProtocol ( buffer ) ) . toThrow ( ) ;
7777 } ) ;
7878
79- it ( 'should read handshake response containing HTTP as the protocol version' , ( ) => {
79+ it ( 'should fail to create protocol from HTTP as invalid version' , ( ) => {
8080 const handshaker = new ProtocolHandshaker ( null , null , null , false , Logger . noOp ( ) ) ;
8181
8282 // buffer with HTTP magic int
8383 const buffer = handshakeResponse ( 1213486160 ) ;
8484
85- expect ( ( ) => handshaker . readHandshakeResponse ( buffer ) ) . toThrow ( ) ;
85+ expect ( ( ) => handshaker . createNegotiatedProtocol ( buffer ) ) . toThrow ( ) ;
8686 } ) ;
8787
8888} ) ;
0 commit comments