コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MockAdapterInboundReply"/> class
 /// </summary>
 /// <param name="pipeServer">The instance of the pipe server</param>
 /// <param name="connectionId">The Id of the connection on which the reply should be sent back</param>
 public MockAdapterInboundReply(
     IAsyncStreamingServer pipeServer,
     int connectionId)
 {
     this.pipeServer   = pipeServer;
     this.connectionId = connectionId;
 }
コード例 #2
0
ファイル: MockReceiveStep.cs プロジェクト: refurbs/transmock
        /// <summary>
        /// Creates the named pipe server
        /// </summary>
        protected virtual void CreateServer()
        {
            // We create and start the server
            this.pipeServer = new StreamingNamedPipeServer(
                this.endpointUri.AbsolutePath);

            this.pipeServer.ReadCompleted += this.pipeServer_ReadCompleted;

            this.pipeServer.Start();
        }
コード例 #3
0
        private async void CleanupServer()
        {
            inboundMesageQueue = null;

            await Task.Factory.StartNew(
                () => mockServer.Stop()
                );

            mockServer = null;

            Console.WriteLine($"ComplexFlow server stopped successfully");
        }
コード例 #4
0
        private async Task InitServerAsync(string receiveURL)
        {
            inboundMesageQueue = new ConcurrentDictionary <int, AsyncReadEventArgs>();

            mockServer = new StreamingNamedPipeServer(new Uri(receiveURL).AbsolutePath);
            mockServer.ReadCompleted += MockServer_ReadCompleted;

            await Task.Factory.StartNew(
                () => mockServer.Start()
                );

            Console.WriteLine($"ComplexFlow server started listening on {receiveURL}");
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MockAdapterInboundReply"/> class
        /// </summary>
        /// <param name="pipeServer">The instance of the pipe server</param>
        /// <param name="connectionId">The Id of the connection on which the reply should be sent back</param>
        public MockAdapterInboundReply(
            IAsyncStreamingServer pipeServer,
            int connectionId,
            Encoding encoding)
        {
            this.pipeServer   = pipeServer;
            this.connectionId = connectionId;

            if (encoding != null)
            {
                this.encoding = encoding;
            }
            else
            {
                this.encoding = Encoding.UTF8;
            }
        }
コード例 #6
0
        /// <summary>
        /// Start the listener
        /// </summary>
        /// <param name="actions">A list of valid actions for starting the operation</param>
        /// <param name="timeout">The timeout for starting the listener</param>
        public void StartListener(string[] actions, TimeSpan timeout)
        {
            this.ParsePropertiesForPromotion();

            lock (this.inboundQueueSyncLock)
            {
                this.inboundQueue = new Queue <MessageConnectionPair>(3);
            }

            this.pipeServer = new StreamingNamedPipeServer(
                this.Connection.ConnectionFactory.ConnectionUri
                .Uri.AbsolutePath);

            this.pipeServer.ClientConnected += this.pipeServer_ClientConnected;
            this.pipeServer.ReadCompleted   += this.pipeServer_ReadCompleted;

            this.pipeServer.Start();
        }
コード例 #7
0
 public void TestCleanup()
 {
     pipeServer.Stop();
     pipeServer = null;
     syncEvent  = null;
 }
コード例 #8
0
 public void TestInitialize()
 {
     syncEvent  = new ManualResetEventSlim(false);
     pipeServer = new StreamingNamedPipeServer("TestPipeServer");
     pipeServer.Start();
 }