//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleMessagesWithIncorrectFields() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleMessagesWithIncorrectFields() { // Given I send a message with the wrong types in its fields //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.bolt.v1.messaging.RecordingByteChannel rawData = new org.neo4j.bolt.v1.messaging.RecordingByteChannel(); RecordingByteChannel rawData = new RecordingByteChannel(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.bolt.v1.packstream.PackStream.Packer packer = new org.neo4j.bolt.v1.packstream.PackStream.Packer(new org.neo4j.bolt.v1.packstream.BufferedChannelOutput(rawData)); PackStream.Packer packer = new PackStream.Packer(new BufferedChannelOutput(rawData)); packer.PackStructHeader(2, RunMessage.SIGNATURE); packer.Pack("RETURN 1"); packer.pack(1234); // Should've been a map packer.Flush(); sbyte[] invalidMessage = rawData.Bytes; // When Connection.connect(Address).send(Util.defaultAcceptedVersions()).send(Util.chunk(32, invalidMessage)); // Then assertThat(Connection, Util.eventuallyReceivesSelectedProtocolVersion()); assertThat(Connection, eventuallyDisconnects()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleUnknownMessages() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleUnknownMessages() { // Given I send a message with an invalid type //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.bolt.v1.messaging.RecordingByteChannel rawData = new org.neo4j.bolt.v1.messaging.RecordingByteChannel(); RecordingByteChannel rawData = new RecordingByteChannel(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.bolt.v1.packstream.PackStream.Packer packer = new org.neo4j.bolt.v1.packstream.PackStream.Packer(new org.neo4j.bolt.v1.packstream.BufferedChannelOutput(rawData)); PackStream.Packer packer = new PackStream.Packer(new BufferedChannelOutput(rawData)); packer.PackStructHeader(1, ( sbyte )0x66); // Invalid message type packer.pack(1234); packer.Flush(); sbyte[] invalidMessage = rawData.Bytes; // When Connection.connect(Address).send(Util.defaultAcceptedVersions()).send(Util.chunk(32, invalidMessage)); // Then assertThat(Connection, Util.eventuallyReceivesSelectedProtocolVersion()); assertThat(Connection, eventuallyDisconnects()); }