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="RpcClient"/> class.
        /// </summary>
        /// <param name="targetEndPoint">
        ///		<see cref="EndPoint"/> for the target.
        /// </param>
        /// <param name="configuration">
        ///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
        /// </param>
        /// <param name="serializationContext">
        ///		A <see cref="SerializationContext"/> to hold serializers.
        ///	</param>
        /// <exception cref="ArgumentNullException">
        ///		<paramref name="targetEndPoint"/> is <c>null</c>.
        /// </exception>
        public RpcClient(EndPoint targetEndPoint, RpcClientConfiguration configuration, SerializationContext serializationContext)
        {
            if (targetEndPoint == null)
            {
                throw new ArgumentNullException("targetEndPoint");
            }

            Contract.EndContractBlock();

            var safeConfiguration = configuration ?? RpcClientConfiguration.Default;

            this._transportManager     = safeConfiguration.TransportManagerProvider(safeConfiguration);
            this._serializationContext = serializationContext ?? new SerializationContext();
            Interlocked.Exchange(ref this._connectTask, this._transportManager.ConnectAsync(targetEndPoint));
        }
Esempio n. 3
0
		/// <summary>
		///		Initializes a new instance of the <see cref="DynamicRpcProxy"/> class.
		/// </summary>
		/// <param name="targetEndPoint">
		///		<see cref="EndPoint"/> for the target.
		/// </param>
		/// <param name="configuration">
		///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
		/// </param>
		/// <param name="serializationContext">
		///		A <see cref="SerializationContext"/> to hold serializers.
		///	</param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="targetEndPoint"/> is <c>null</c>.
		/// </exception>
		public DynamicRpcProxy( EndPoint targetEndPoint, RpcClientConfiguration configuration, SerializationContext serializationContext )
			: this( new RpcClient( targetEndPoint, configuration, serializationContext ) ) { }
Esempio n. 4
0
		/// <summary>
		///		Initializes a new instance of the <see cref="DynamicRpcProxy"/> class.
		/// </summary>
		/// <param name="targetEndPoint">
		///		<see cref="EndPoint"/> for the target.
		/// </param>
		/// <param name="configuration">
		///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="targetEndPoint"/> is <c>null</c>.
		/// </exception>
		public DynamicRpcProxy( EndPoint targetEndPoint, RpcClientConfiguration configuration )
			: this( new RpcClient( targetEndPoint, configuration ) ) { }
Esempio n. 5
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcClient"/> class.
		/// </summary>
		/// <param name="targetEndPoint">
		///		<see cref="EndPoint"/> for the target.
		/// </param>
		/// <param name="configuration">
		///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
		/// </param>
		/// <param name="serializationContext">
		///		A <see cref="SerializationContext"/> to hold serializers.
		///	</param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="targetEndPoint"/> is <c>null</c>.
		/// </exception>
		public RpcClient( EndPoint targetEndPoint, RpcClientConfiguration configuration, SerializationContext serializationContext )
		{
			if ( targetEndPoint == null )
			{
				throw new ArgumentNullException( "targetEndPoint" );
			}

			Contract.EndContractBlock();

			var safeConfiguration = configuration ?? RpcClientConfiguration.Default;

			this._transportManager = safeConfiguration.TransportManagerProvider( safeConfiguration );
			this._serializationContext = serializationContext ?? new SerializationContext();
			Interlocked.Exchange( ref this._connectTask, this._transportManager.ConnectAsync( targetEndPoint ) );
		}
Esempio n. 6
0
		/// <summary>
		///		Initializes a new instance of the <see cref="RpcClient"/> class.
		/// </summary>
		/// <param name="targetEndPoint">
		///		<see cref="EndPoint"/> for the target.
		/// </param>
		/// <param name="configuration">
		///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
		/// </param>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="targetEndPoint"/> is <c>null</c>.
		/// </exception>
		public RpcClient( EndPoint targetEndPoint, RpcClientConfiguration configuration ) : this( targetEndPoint, configuration, null ) { }
Esempio n. 7
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 );
			}
Esempio n. 8
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="DynamicRpcProxy"/> class.
 /// </summary>
 /// <param name="targetEndPoint">
 ///		<see cref="EndPoint"/> for the target.
 /// </param>
 /// <param name="configuration">
 ///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
 /// </param>
 /// <param name="serializationContext">
 ///		A <see cref="SerializationContext"/> to hold serializers.
 ///	</param>
 /// <exception cref="ArgumentNullException">
 ///		<paramref name="targetEndPoint"/> is <c>null</c>.
 /// </exception>
 public DynamicRpcProxy(EndPoint targetEndPoint, RpcClientConfiguration configuration, SerializationContext serializationContext)
     : this(new RpcClient(targetEndPoint, configuration, serializationContext))
 {
 }
Esempio n. 9
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="DynamicRpcProxy"/> class.
 /// </summary>
 /// <param name="targetEndPoint">
 ///		<see cref="EndPoint"/> for the target.
 /// </param>
 /// <param name="configuration">
 ///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///		<paramref name="targetEndPoint"/> is <c>null</c>.
 /// </exception>
 public DynamicRpcProxy(EndPoint targetEndPoint, RpcClientConfiguration configuration)
     : this(new RpcClient(targetEndPoint, configuration))
 {
 }
Esempio n. 10
0
 /// <summary>
 ///		Initializes a new instance of the <see cref="RpcClient"/> class.
 /// </summary>
 /// <param name="targetEndPoint">
 ///		<see cref="EndPoint"/> for the target.
 /// </param>
 /// <param name="configuration">
 ///		A <see cref="RpcClientConfiguration"/> which contains protocol information etc.
 /// </param>
 /// <exception cref="ArgumentNullException">
 ///		<paramref name="targetEndPoint"/> is <c>null</c>.
 /// </exception>
 public RpcClient(EndPoint targetEndPoint, RpcClientConfiguration configuration) : this(targetEndPoint, configuration, null)
 {
 }