/// <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; }
/// <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(); }
private async void CleanupServer() { inboundMesageQueue = null; await Task.Factory.StartNew( () => mockServer.Stop() ); mockServer = null; Console.WriteLine($"ComplexFlow server stopped successfully"); }
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}"); }
/// <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; } }
/// <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(); }
public void TestCleanup() { pipeServer.Stop(); pipeServer = null; syncEvent = null; }
public void TestInitialize() { syncEvent = new ManualResetEventSlim(false); pipeServer = new StreamingNamedPipeServer("TestPipeServer"); pipeServer.Start(); }