//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleFragmentedMessage() public virtual void ShouldHandleFragmentedMessage() { // Given BoltProtocol protocol = NewBoltProtocol(1); BoltProtocolFactory handlerFactory = NewProtocolFactory(1, protocol); EmbeddedChannel channel = new EmbeddedChannel(new ProtocolHandshaker(handlerFactory, _boltChannel, _logProvider, false, true)); // When channel.writeInbound(Unpooled.wrappedBuffer(new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0) })); assertEquals(0, channel.outboundMessages().size()); channel.writeInbound(Unpooled.wrappedBuffer(new sbyte[] { ( sbyte )0x17, 0, 0, 0 })); assertEquals(0, channel.outboundMessages().size()); channel.writeInbound(Unpooled.wrappedBuffer(new sbyte[] { 0, 0, 0 })); assertEquals(0, channel.outboundMessages().size()); channel.writeInbound(Unpooled.wrappedBuffer(new sbyte[] { 0, 1, 0, 0, 0 })); assertEquals(0, channel.outboundMessages().size()); channel.writeInbound(Unpooled.wrappedBuffer(new sbyte[] { 0, 0, 0 })); assertEquals(0, channel.outboundMessages().size()); channel.writeInbound(Unpooled.wrappedBuffer(new sbyte[] { 0, 0 })); // Then assertEquals(1, channel.outboundMessages().size()); assertByteBufEquals(Unpooled.buffer().writeInt(1), channel.readOutbound()); 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 void shouldInstallTransportSelectionHandler() internal virtual void ShouldInstallTransportSelectionHandler() { SocketTransport socketTransport = NewSocketTransport(NetworkConnectionTracker.NO_OP, NO_THROTTLE); EmbeddedChannel channel = new EmbeddedChannel(socketTransport.ChannelInitializer()); TransportSelectionHandler handler = channel.pipeline().get(typeof(TransportSelectionHandler)); assertNotNull(handler); }
//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(); }