private FluentNSubsituteRequestResponseCollectionBuilder SetUpRequestResponse( byte[] request, byte[] response ) { _requestResponseCollection .GetResponse(Arg.Is <byte[]>( x => x.SequenceEqual(request) )) .Returns(response); return(this); }
public void Run() { _socket.Listen(10); _threadOperations.RunBackground( () => { _threadOperations.WaitUntilActionTimeout(() => { while (true) { try { var handle = _socket.Accept(); var buffer = new byte[8]; handle.Receive(buffer); var payload = _requestResponseCollection.GetResponse(buffer); if (payload != null) { handle.Send(payload); } handle.Close(); } catch (Exception) { //ignore } } }, 50); } ); }