//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleHandshakeFollowedImmediatelyByMessage()
        public virtual void ShouldHandleHandshakeFollowedImmediatelyByMessage()
        {
            // Given
            BoltProtocol        protocol       = NewBoltProtocol(1);
            BoltProtocolFactory handlerFactory = NewProtocolFactory(1, protocol);
            EmbeddedChannel     channel        = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, false, true));

            // When
            ByteBuf input = Unpooled.wrappedBuffer(new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0), ( sbyte )0x17 }, new sbyte[] { 0, 0, 0, 0 }, new sbyte[] { 0, 0, 0, 1 }, new sbyte[] { 0, 0, 0, 0 }, new sbyte[] { 0, 0, 0, 0 }, new sbyte[] { 1, 2, 3, 4 });                // this is a message

            channel.writeInbound(input);

            // Then
            assertEquals(1, channel.outboundMessages().size());
            assertByteBufEquals(Unpooled.buffer().writeInt(1), channel.readOutbound());

            assertEquals(1, channel.inboundMessages().size());
            assertByteBufEquals(Unpooled.wrappedBuffer(new sbyte[] { 1, 2, 3, 4 }), channel.readInbound());

            Thrown.expect(typeof(NoSuchElementException));
            channel.pipeline().remove(typeof(ProtocolHandshaker));

            assertTrue(channel.Active);
            verify(protocol).install();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRejectIfInsecureWhenEncryptionRequired()
        public virtual void ShouldRejectIfInsecureWhenEncryptionRequired()
        {
            // Given
            BoltProtocol        protocol       = NewBoltProtocol(1);
            BoltProtocolFactory handlerFactory = NewProtocolFactory(1, protocol);
            EmbeddedChannel     channel        = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, true, false));

            // When
            ByteBuf input = Unpooled.wrappedBuffer(new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0), ( sbyte )0x17 }, new sbyte[] { 0, 0, 0, 1 }, new sbyte[] { 0, 0, 0, 2 }, new sbyte[] { 0, 0, 0, 3 }, new sbyte[] { 0, 0, 0, 4 });                 // fourth choice - no protocol

            channel.writeInbound(input);

            // Then
            assertEquals(0, channel.outboundMessages().size());
            assertFalse(channel.Active);
            verify(protocol, never()).install();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRejectIfHttp()
        public virtual void ShouldRejectIfHttp()
        {
            // Given
            BoltProtocol        protocol       = NewBoltProtocol(1);
            BoltProtocolFactory handlerFactory = NewProtocolFactory(1, protocol);
            EmbeddedChannel     channel        = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, false, true));

            // When
            FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "http://hello_world:10000");

            request.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, 0);
            channel.writeInbound(request);

            // Then
            assertEquals(0, channel.outboundMessages().size());
            assertFalse(channel.Active);
            verify(protocol, never()).install();
            _logProvider.assertExactly(AssertableLogProvider.inLog(typeof(ProtocolHandshaker)).warn("Unsupported connection type: 'HTTP'. Bolt protocol only operates over a TCP connection or WebSocket."));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFallbackToNoProtocolIfNoMatch()
        public virtual void ShouldFallbackToNoProtocolIfNoMatch()
        {
            // Given
            BoltProtocol        protocol       = NewBoltProtocol(1);
            BoltProtocolFactory handlerFactory = NewProtocolFactory(1, protocol);
            EmbeddedChannel     channel        = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, false, true));

            // When
            ByteBuf input = Unpooled.wrappedBuffer(new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0), ( sbyte )0x17 }, new sbyte[] { 0, 0, 0, 0 }, new sbyte[] { 0, 0, 0, 2 }, new sbyte[] { 0, 0, 0, 3 }, new sbyte[] { 0, 0, 0, 4 });                 // fourth choice - no protocol

            channel.writeInbound(input);

            // Then
            assertEquals(1, channel.outboundMessages().size());
            assertByteBufEquals(Unpooled.buffer().writeInt(0), channel.readOutbound());

            assertFalse(channel.Active);
            verify(protocol, never()).install();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleMaxVersionNumber()
        public virtual void ShouldHandleMaxVersionNumber()
        {
            long maxVersionNumber = 4_294_967_295L;

            // Given
            BoltProtocol        protocol       = NewBoltProtocol(maxVersionNumber);
            BoltProtocolFactory handlerFactory = NewProtocolFactory(maxVersionNumber, protocol);
            EmbeddedChannel     channel        = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, false, true));

            // When
            ByteBuf input = Unpooled.wrappedBuffer(new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0), ( sbyte )0x17 }, new sbyte[] { unchecked (( sbyte )0xFF), unchecked (( sbyte )0xFF), unchecked (( sbyte )0xFF), unchecked (( sbyte )0xFF) }, new sbyte[] { 0, 0, 0, 0 }, new sbyte[] { 0, 0, 0, 0 }, new sbyte[] { 0, 0, 0, 0 });                         // fourth choice - no protocol

            channel.writeInbound(input);

            // Then
            assertEquals(1, channel.outboundMessages().size());
            assertByteBufEquals(Unpooled.buffer().writeInt((int)maxVersionNumber), channel.readOutbound());

            Thrown.expect(typeof(NoSuchElementException));
            channel.pipeline().remove(typeof(ProtocolHandshaker));

            assertTrue(channel.Active);
            verify(protocol).install();
        }