protected virtual void OnExecute(ISimoConnection connection) { var request = GenerateRequest(); using (var requestStream = connection.GetPipeStream()) { using (var requestWriter = new RequestWriter(requestStream)) { requestWriter.Write(request); OnRequestSent(); } } }
public void MemoryRequestWriterBasic() { var stressTester = new StressTester(); var writer = new RequestWriter(stressTester); int requestCount = 10_000_001; for (int i = 0; i < requestCount; i++) { var req = new HttpRequestData { TimeTakenMs = 10, Timestamp = DateTime.Now, Url = "http://localhost" }; writer.Write(req); } Assert.IsTrue(writer.RequestsProcessed == requestCount); Assert.IsTrue(writer.GetResults().Count == requestCount); }
private static void PlayWithConnection() { using var tcpClient = new TcpClient(host, port); var stream = tcpClient.GetStream(); var buffer = new byte[512]; using var requestWriter = new RequestWriter(stream); var responseReader = new ResponseReader(stream); stream.Read(buffer); var base64Salt = new ReadOnlySpan <byte>(buffer, 64, 44); var authRequest = new AuthRequest("user_test", "user_test", base64Salt) { SyncId = 1 }; requestWriter.Write(authRequest); var authResponse = responseReader.Read(); //var selectRequest = new SelectRequest((uint)SystemSpaceE.Vspace, 0, IteratorE.All, 0U) {SyncId = 2}; //requestWriter.Write(selectRequest); //var selectResponse = responseReader.Read(); }