示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void doRead(Neo4jPack_Unpacker unpacker) throws java.io.IOException
        private void DoRead(Neo4jPack_Unpacker unpacker)
        {
            try
            {
                unpacker.UnpackStructHeader();
                int signature = unpacker.UnpackStructSignature();

                RequestMessageDecoder decoder = _decoders[signature];
                if (decoder == null)
                {
                    throw new BoltIOException(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.InvalidFormat, string.Format("Message 0x{0} is not a valid message signature.", signature.ToString("x")));
                }

                RequestMessage      message         = decoder.Decode(unpacker);
                BoltResponseHandler responseHandler = decoder.ResponseHandler();

                _connection.enqueue(stateMachine => stateMachine.process(message, responseHandler));
            }
            catch (PackStream.PackStreamException e)
            {
                throw new BoltIOException(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.InvalidFormat, string.Format("Unable to read message type. Error was: {0}.", e.Message), e);
            }
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void assertOriginalMessageEqualsToDecoded(org.neo4j.bolt.messaging.RequestMessage originalMessage, org.neo4j.bolt.messaging.RequestMessageDecoder decoder) throws Exception
        internal static void AssertOriginalMessageEqualsToDecoded(RequestMessage originalMessage, RequestMessageDecoder decoder)
        {
            Neo4jPack neo4jPack = newNeo4jPack();

            PackedInputArray input = new PackedInputArray(encode(neo4jPack, originalMessage));

            Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = neo4jPack.NewUnpacker(input);

            // these two steps are executed before decoding in order to select a correct decoder
            unpacker.UnpackStructHeader();
            unpacker.UnpackStructSignature();

            RequestMessage deserializedMessage = decoder.Decode(unpacker);

            assertEquals(originalMessage, deserializedMessage);
        }