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();
        }
Beispiel #2
0
 private void Channel_DataReceived(object sender, Common.ChannelDataEventArgs e)
 {
     if (this._outputStream != null)
     {
         this._outputStream.Write(e.Data, 0, e.Data.Length);
     }
 }
Beispiel #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;
            }
        }
Beispiel #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;
                }
            }
        }
Beispiel #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;
            }
        }
Beispiel #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;
                }
            }
        }
Beispiel #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);
        }
Beispiel #9
0
 private void Channel_ExtendedDataReceived(object sender, ChannelDataEventArgs e)
 {
     if (this._extendedOutputStream != null)
     {
         this._extendedOutputStream.Write(e.Data, 0, e.Data.Length);
     }
 }
Beispiel #10
0
 private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
 {
     try
     {
         OnDataReceived(e.DataTypeCode, e.Data);
     }
     catch (Exception ex)
     {
         RaiseError(ex);
     }
 }
Beispiel #11
0
 private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
 {
     if (_outputStream != null)
     {
         _outputStream.Write(e.Data, 0, e.Data.Length);
     }
 }
Beispiel #12
0
 private void Channel_DataReceived(object sender, ChannelDataEventArgs e)
 {
     this.OnDataReceived(e.DataTypeCode, e.Data);
 }
Beispiel #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);
        }