/// <summary>
 /// Create a new instance of a socket server
 /// </summary>
 internal RpcSslSocketServer(TcpRpcEndPoint rpcEndPoint, IRpcConnectionHandler connectionHandler, int maxRequestSize, ImmutableArrayList <AuthenticationServerOptions> authenticationOptions)
 {
     this.connectionHandler     = connectionHandler;
     this.rpcEndPoint           = rpcEndPoint;
     this.maxRequestSize        = maxRequestSize;
     this.authenticationOptions = authenticationOptions;
 }
 /// <summary>
 /// Create a new instance of a named pipe server
 /// </summary>
 internal RpcPipeServer(NamedPipeRpcEndPoint endPoint, IRpcConnectionHandler connectionHandler, int maxRequestSize)
     : base(endPoint.uri)
 {
     this.endPoint          = endPoint;
     this.connectionHandler = connectionHandler;
     this.maxRequestSize    = maxRequestSize;
 }
        protected internal override ILightweightRpcListener CreateListener(IRpcConnectionHandler connectionHandler, int maxRequestSize, int maxResponseSize)
        {
            var listener = new TestDiscoveryListener(this, connectionHandler);

            this.listeners.Add(listener);
            return(listener);
        }
        protected internal override ILightweightRpcListener CreateListener(
            IRpcConnectionHandler connectionHandler,
            int maxRequestSize, int maxResponseSize)
        {
            IDuplexPipe pipe;

            lock (this.syncRoot)
            {
                if (this.clientPipe == null)
                {
                    throw new InvalidOperationException("A DirectLightweightRpcEndPoint listener can only be created once.");
                }
                pipe            = this.clientPipe;
                this.clientPipe = null;
            }

            return(new DirectListener(this, pipe, connectionHandler));
        }
示例#5
0
        internal static async Task <TResponse> SendReceiveDatagramAsync <TRequest, TResponse>(
            LightweightRpcEndPoint endPoint,
            IRpcConnectionHandler connectionHandler,
            string operationName,
            TRequest request,
            IRpcSerializer serializer,
            CancellationToken cancellationToken = default)
            where TRequest : class
            where TResponse : class
        {
            byte[] requestData = GetRequestData(operationName, 1, request, serializer);

            var responseData = await connectionHandler.HandleDatagramAsync(endPoint, requestData, cancellationToken);

            Assert.NotNull(responseData);

            TResponse response = GetResponseFromData <TResponse>(serializer, responseData);

            return(response);
        }
 protected internal abstract ILightweightRpcListener CreateListener(
     IRpcConnectionHandler connectionHandler,
     int maxRequestSize, int maxResponseSize);
 protected internal override ILightweightRpcListener CreateListener(
     IRpcConnectionHandler connectionHandler,
     int maxRequestSize, int maxResponseSize)
 {
     return(new RpcSslSocketServer(this, connectionHandler, maxRequestSize, this.authenticationOptions));
 }
 public TestDiscoveryListener(TestDiscoveryEndPoint endPoint, IRpcConnectionHandler connectionHandler)
 {
     this.endPoint          = endPoint;
     this.connectionHandler = connectionHandler;
 }
 protected internal override ILightweightRpcListener CreateListener(
     IRpcConnectionHandler connectionHandler,
     int maxRequestSize, int maxResponseSize)
 {
     return(new RpcPipeServer(this, connectionHandler, maxRequestSize));
 }
示例#10
0
 protected internal override ILightweightRpcListener CreateListener(IRpcConnectionHandler discoveryHandler, int maxRequestSize, int maxResponseSize)
 {
     throw new NotImplementedException();
 }
 internal DirectListener(InprocRpcEndPoint endPoint, IDuplexPipe pipe, IRpcConnectionHandler connectionHandler)
 {
     this.endPoint          = endPoint;
     this.pipe              = pipe;
     this.connectionHandler = connectionHandler;
 }
 public DiscoveryRpcListener(LightweightDiscoveryEndPoint endPoint, IRpcConnectionHandler connectionHandler, ILogger?logger)
 {
     this.endPoint          = endPoint;
     this.connectionHandler = connectionHandler;
     this.logger            = logger;
 }
 protected internal override ILightweightRpcListener CreateListener(
     IRpcConnectionHandler connectionHandler,
     int maxRequestSize, int maxResponseSize)
 {
     return(new DiscoveryRpcListener(this, connectionHandler, this.logger));
 }