예제 #1
0
        public async Task <Connection> Connect(ReWorkClientRole role)
        {
            var cts         = new CancellationTokenSource();
            var tConnection = await _transportManager.ConnectAsync(role, cts.Token);

            var connection = _factory.Create(Guid.Empty.ToString(), tConnection, this);

            //once again, just fire and forget, and use the CancellationToken
            //to signal to the "forgotten" async invocation.
            connection.Authorize();
            connection.ProcessCommandsAsync(cts.Token);
            await connection.Send(new InitiateHandshakeMessage());

            return(connection);
        }