Provides data for Renci.SshNet.Channels.Channel.DataReceived event and Renci.SshNet.Channels.Channel.ExtendedDataReceived events.
Inheritance: ChannelEventArgs
        protected void Arrange()
        {
            var random = new Random();
            _subsystemName = random.Next().ToString(CultureInfo.InvariantCulture);
            _operationTimeout = TimeSpan.FromSeconds(30);
            _encoding = Encoding.UTF8;
            _disconnectedRegister = new List<EventArgs>();
            _errorOccurredRegister = new List<ExceptionEventArgs>();
            _channelDataEventArgs = new ChannelDataEventArgs(
                (uint)random.Next(0, int.MaxValue),
                new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) });

            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
            _channelMock = new Mock<IChannelSession>(MockBehavior.Strict);

            _sequence = new MockSequence();
            _sessionMock.InSequence(_sequence).Setup(p => p.CreateChannelSession()).Returns(_channelMock.Object);
            _channelMock.InSequence(_sequence).Setup(p => p.Open());
            _channelMock.InSequence(_sequence).Setup(p => p.SendSubsystemRequest(_subsystemName)).Returns(true);

            _subsystemSession = new SubsystemSessionStub(
                _sessionMock.Object,
                _subsystemName,
                _operationTimeout,
                _encoding);
            _subsystemSession.Disconnected += (sender, args) => _disconnectedRegister.Add(args);
            _subsystemSession.ErrorOccurred += (sender, args) => _errorOccurredRegister.Add(args);
            _subsystemSession.Connect();
        }
Exemple #2
0
 private void Channel_DataReceived(object sender, Common.ChannelDataEventArgs e)
 {
     if (this._outputStream != null)
     {
         this._outputStream.Write(e.Data, 0, e.Data.Length);
     }
 }
Exemple #3
0
        private void Channel_ExtendedDataReceived(object sender, Common.ChannelDataEventArgs e)
        {
            if (this.ExtendedOutputStream != null)
            {
                this.ExtendedOutputStream.Write(e.Data, 0, e.Data.Length);
                this.ExtendedOutputStream.Flush();
            }

            if (e.DataTypeCode == 1)
            {
                this._hasError = true;
            }
        }
Exemple #4
0
        private void Channel_DataReceived(object sender, Common.ChannelDataEventArgs e)
        {
            if (this.OutputStream != null)
            {
                this.OutputStream.Write(e.Data, 0, e.Data.Length);
                this.OutputStream.Flush();
            }

            if (this._asyncResult != null)
            {
                lock (this._asyncResult)
                {
                    this._asyncResult.BytesReceived += e.Data.Length;
                }
            }
        }
Exemple #5
0
        private void Channel_ExtendedDataReceived(object sender, ChannelDataEventArgs e)
        {
            if (this.ExtendedOutputStream != null)
            {
                this.ExtendedOutputStream.Write(e.Data, 0, e.Data.Length);
                this.ExtendedOutputStream.Flush();
            }

            if (e.DataTypeCode == 1)
            {
                this._hasError = true;
            }
        }
Exemple #6
0
        private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
        {
            if (this.OutputStream != null)
            {
                this.OutputStream.Write(e.Data, 0, e.Data.Length);
                this.OutputStream.Flush();
            }

            if (this._asyncResult != null)
            {
                lock (this._asyncResult)
                {
                    this._asyncResult.BytesReceived += e.Data.Length;
                }
            }
        }
Exemple #7
0
        private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
        {
            lock (_incoming)
            {
                foreach (var b in e.Data)
                    _incoming.Enqueue(b);
            }

            if (_dataReceived != null)
                _dataReceived.Set();

            OnDataReceived(e.Data);
        }
        private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
        {
            foreach (var b in e.Data)
            {
                _incoming.Enqueue(b);
            }

            this._dataReceived.Set();

            this.OnDataReceived(e.Data);
        }
Exemple #9
0
 private void Channel_ExtendedDataReceived(object sender, ChannelDataEventArgs e)
 {
     if (this._extendedOutputStream != null)
     {
         this._extendedOutputStream.Write(e.Data, 0, e.Data.Length);
     }
 }
 private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
 {
     try
     {
         OnDataReceived(e.DataTypeCode, e.Data);
     }
     catch (Exception ex)
     {
         RaiseError(ex);
     }
 }
Exemple #11
0
 private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
 {
     if (_outputStream != null)
     {
         _outputStream.Write(e.Data, 0, e.Data.Length);
     }
 }
 private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
 {
     this.OnDataReceived(e.DataTypeCode, e.Data);
 }
Exemple #13
0
        private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
        {
            lock (this._incoming)
            {
                foreach (var b in e.Data)
                {
                    _incoming.Enqueue(b);
                }

                Monitor.Pulse(this._incoming);
            }

            this.OnDataReceived(e.Data);
        }