public SocketClientTests() { this.socketClient = new SocketClient(); var endpoint = new IPEndPoint(IPAddress.Loopback, 0); this.tcpListener = new TcpListener(endpoint); }
/// <summary> /// Initializes a new instance of the <see cref="TestRequestSender"/> class. /// Used only for testing to inject communication endpoint. /// </summary> /// <param name="communicationEndPoint">Communication server implementation.</param> /// <param name="connectionInfo">ConnectionInfo to set up transport layer</param> /// <param name="serializer">Serializer implementation.</param> /// <param name="protocolConfig">Protocol configuration.</param> /// <param name="clientExitedWaitTime">Time to wait for client process exit.</param> internal TestRequestSender( ICommunicationEndPoint communicationEndPoint, TestHostConnectionInfo connectionInfo, IDataSerializer serializer, ProtocolConfig protocolConfig, int clientExitedWaitTime) : this(connectionInfo, serializer, protocolConfig, clientExitedWaitTime) { this.communicationEndpoint = communicationEndPoint; }
protected TestRequestHandler(TestHostConnectionInfo connectionInfo, ICommunicationEndPoint communicationEndpoint, IDataSerializer dataSerializer, JobQueue <Action> jobQueue, Action <Message> onAckMessageRecieved) { this.communicationEndPoint = communicationEndpoint; this.connectionInfo = connectionInfo; this.dataSerializer = dataSerializer; this.requestSenderConnected = new ManualResetEventSlim(false); this.testHostManagerFactoryReady = new ManualResetEventSlim(false); this.sessionCompleted = new ManualResetEventSlim(false); this.onAckMessageRecieved = onAckMessageRecieved; this.jobQueue = jobQueue; }
/// <summary> /// Initializes a new instance of the <see cref="TestRequestSender"/> class. /// Used only for testing to inject communication endpoint. /// </summary> /// <param name="communicationEndPoint">Communication server implementation.</param> /// <param name="connectionInfo">ConnectionInfo to set up transport layer</param> /// <param name="serializer">Serializer implementation.</param> /// <param name="protocolConfig">Protocol configuration.</param> /// <param name="clientExitedWaitTime">Time to wait for client process exit.</param> internal TestRequestSender( ICommunicationEndPoint communicationEndPoint, TestHostConnectionInfo connectionInfo, IDataSerializer serializer, ProtocolConfig protocolConfig, int clientExitedWaitTime) : this( runtimeProvider : null, communicationEndPoint, connectionInfo, serializer, protocolConfig, clientExitedWaitTime) { }
/// <inheritdoc /> public virtual void InitializeCommunication() { this.communicationEndPoint = this.communicationEndpointFactory.Create(this.ConnectionInfo.Role); this.communicationEndPoint.Connected += (sender, connectedArgs) => { if (!connectedArgs.Connected) { requestSenderConnected.Set(); throw connectedArgs.Fault; } this.channel = connectedArgs.Channel; this.channel.MessageReceived += this.OnMessageReceived; requestSenderConnected.Set(); }; this.communicationEndPoint.Start(this.ConnectionInfo.Endpoint); }
private void SetCommunicationEndPoint() { if (this.connectionInfo.Role == ConnectionRole.Host) { this.communicationEndPoint = new SocketServer(); if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestRequestHanlder is acting as server"); } } else { this.communicationEndPoint = new SocketClient(); if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestRequestHanlder is acting as client"); } } }
private void SetCommunicationEndPoint() { // TODO: Use factory to get the communication endpoint. It will abstract out the type of communication endpoint like socket, shared memory or named pipe etc., if (this.connectionInfo.Role == ConnectionRole.Client) { this.communicationEndpoint = new SocketClient(); if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestRequestSender is acting as client"); } } else { this.communicationEndpoint = new SocketServer(); if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestRequestSender is acting as server"); } } }
internal TestRequestSender( ITestRuntimeProvider runtimeProvider, ICommunicationEndPoint communicationEndPoint, TestHostConnectionInfo connectionInfo, IDataSerializer serializer, ProtocolConfig protocolConfig, int clientExitedWaitTime) { this.dataSerializer = serializer; this.connected = new ManualResetEventSlim(false); this.clientExited = new ManualResetEventSlim(false); this.clientExitedWaitTime = clientExitedWaitTime; this.operationCompleted = 0; this.highestSupportedVersion = protocolConfig.Version; // The connectionInfo here is that of RuntimeProvider, so reverse the role of runner. this.runtimeProvider = runtimeProvider; this.communicationEndpoint = communicationEndPoint; this.connectionInfo.Endpoint = connectionInfo.Endpoint; this.connectionInfo.Role = connectionInfo.Role == ConnectionRole.Host ? ConnectionRole.Client : ConnectionRole.Host; }
public TestableTestRequestSender(ICommunicationEndPoint commEndpoint, TestHostConnectionInfo connectionInfo, IDataSerializer serializer, ProtocolConfig protocolConfig) : base(commEndpoint, connectionInfo, serializer, protocolConfig, 0) { }
public TestableTestRequestHandler(TestHostConnectionInfo testHostConnectionInfo, ICommunicationEndPoint communicationClient, IDataSerializer dataSerializer, JobQueue <Action> jobQueue) : base(testHostConnectionInfo, communicationClient, dataSerializer, jobQueue, OnAckMessageReceived) { }
public SocketServerTests() { this.socketServer = new SocketServer(); this.tcpClient = new TcpClient(); }