Exemple #1
0
        public static async Task <ConnectHeader> FromIOAsync(XmlRpcIO io)
        {
            int    length   = BitConverter.ToInt32(await io.ReadBytesAsync(4));
            string protocol = Encoding.ASCII.GetString(await io.ReadBytesAsync(length));

            return(new ConnectHeader(length, protocol));
        }
Exemple #2
0
        public static async Task <MessageHeader> FromIOAsync(XmlRpcIO io)
        {
            int  length = BitConverter.ToInt32(await io.ReadBytesAsync(4));
            uint handle = BitConverter.ToUInt32(await io.ReadBytesAsync(4));

            return(new MessageHeader(length, handle));
        }
Exemple #3
0
        public void IsCallback_Returns_False_On_MethodResponse()
        {
            XmlRpcIO io = fixture.NewIO(fixture.MethodResponseBytes);

            MessageHeader header = MessageHeader.FromIOAsync(io).GetAwaiter().GetResult();

            Assert.False(header.IsCallback);
        }
Exemple #4
0
        public static async Task <ResponseMessage> FromIOAsync(XmlRpcIO io)
        {
            var header = await MessageHeader.FromIOAsync(io);

            var message = Encoding.UTF8.GetString(await io.ReadBytesAsync(header.MessageLength));

            return(new ResponseMessage(header, message));
        }
Exemple #5
0
        public void FromIOAsync_Parses_Correctly_From_Stream()
        {
            XmlRpcIO      io     = fixture.NewIO(fixture.ConnectionHeaderBytes);
            ConnectHeader header = ConnectHeader.FromIOAsync(io).GetAwaiter().GetResult();

            Assert.Equal(10, header.Length);
            Assert.Equal("Test Input", header.Protocol);
        }
Exemple #6
0
        public void FromIOAsync_Correctly_Parses_MethodResponse_Message()
        {
            XmlRpcIO io = fixture.NewIO(fixture.MethodResponseBytes);

            MessageHeader header = MessageHeader.FromIOAsync(io).GetAwaiter().GetResult();

            Assert.Equal(159, header.MessageLength);
            Assert.Equal(0x80000004, header.Handle);
        }
Exemple #7
0
        public void FromIOAsync_Correctly_Parses_MethodCall_Message()
        {
            XmlRpcIO io = fixture.NewIO(fixture.MethodCallHeaderBytes);

            MessageHeader header = MessageHeader.FromIOAsync(io).GetAwaiter().GetResult();

            Assert.Equal(1123, header.MessageLength);
            Assert.Equal((uint)5, header.Handle);
        }
        public void FromIOAsync_Correctly_Parses_Message()
        {
            XmlRpcIO        io       = fixture.NewIO(fixture.MethodResponseBytes);
            ResponseMessage response = ResponseMessage.FromIOAsync(io).GetAwaiter().GetResult();

            var responseValue = ((XmlRpcString)response.ResponseData).Value;

            Assert.False(response.IsCallback);
            Assert.False(response.IsFault);
            Assert.Equal("Example Response Value", responseValue);
        }