public async Task ReturnTheRequest(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify) { protocolVerify.SetupRequest(_anyObject); var requestBytes = await protocol.ReadRequestAsync(); var request = TestSerializer.Deserialize <AnyObject>(requestBytes); request.Should().BeOfType <AnyObject>(); request.anyInt.Should().Be(_anyObject.anyInt); request.anyString.Should().Be(_anyObject.anyString); }
internal async Task HandleIncomingStream() { var requestBytes = await _protocolReceiver.ReadRequestAsync(); var functionName = await _protocolReceiver.GetRequestFunctionAsync(); //TODO: replace with right server actions (below for sample only) //Console.WriteLine($"Function to call: {functionName}"); //Console.WriteLine($"req message: {Encoding.ASCII.GetString(requestBytes)}"); byte[] responseBytes = Encoding.ASCII.GetBytes("hello world"); var headers = new Dictionary <string, string> { { ":status", "200" }, { "info", "pass" } }; await _protocolReceiver.SendResponseAsync(headers, responseBytes); }
public void ThrowTimeoutException_WhenNoRequestData(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify) { Func <Task> action = async() => await protocol.ReadRequestAsync(); action.Should().Throw <TimeoutException>(); }