Esempio n. 1
0
 public InProcTestEnvironment(Func <int?, MessagePackObject[], MessagePackObject> callback)
 {
     this._endPoint      = new IPEndPoint(IPAddress.Loopback, MsgPack.Rpc.Server.CallbackServer.PortNumber);
     this._server        = MsgPack.Rpc.Server.CallbackServer.Create(callback, true);
     this._configuration = RpcClientConfiguration.Default.Clone();
     this._configuration.TransportManagerProvider = conf => this._clientTransportManager;
     this._configuration.Freeze();
     this._serverTransportManager = new MsgPack.Rpc.Server.Protocols.InProcServerTransportManager(this._server.Server as Server.RpcServer, mgr => new SingletonObjectPool <Server.Protocols.InProcServerTransport>(new Server.Protocols.InProcServerTransport(mgr)));
     this._clientTransportManager = new InProcClientTransportManager(new RpcClientConfiguration(), this._serverTransportManager);
 }
Esempio n. 2
0
		/// <summary>
		///		Initializes a new instance of the <see cref="InProcClientTransport"/> class.
		/// </summary>
		/// <param name="manager">The manager which will manage this instance.</param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="manager"/> is <c>null</c>.
		/// </exception>
		public InProcClientTransport( InProcClientTransportManager manager )
			: base( manager )
		{
			this._inboundQueue = new BlockingCollection<byte[]>();
			this._pendingPackets = new ConcurrentQueue<InProcPacket>();
			this._cancellationTokenSource = new CancellationTokenSource();
			this._linkedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource( this._cancellationTokenSource.Token, manager.CancellationToken );
			Interlocked.Exchange( ref this._canSend, 1 );
		}
Esempio n. 3
0
			public InProcTestEnvironment( Func<string, int?, MessagePackObject[], MessagePackObject> callback )
			{
				this._endPoint = new IPEndPoint( IPAddress.Loopback, MsgPack.Rpc.Server.CallbackServer.PortNumber );
				this._server = MsgPack.Rpc.Server.CallbackServer.Create( callback, true );
				this._configuration = RpcClientConfiguration.Default.Clone();
				this._configuration.TransportManagerProvider = conf => this._clientTransportManager;
				this._configuration.Freeze();
				this._serverTransportManager = new MsgPack.Rpc.Server.Protocols.InProcServerTransportManager( this._server.Server as Server.RpcServer, mgr => new SingletonObjectPool<Server.Protocols.InProcServerTransport>( new Server.Protocols.InProcServerTransport( mgr ) ) );
				this._clientTransportManager = new InProcClientTransportManager( new RpcClientConfiguration(), this._serverTransportManager );
			}