| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Renci.SshNet.Common;
- using Renci.SshNet.Tests.Common;
- using Renci.SshNet.Tests.Properties;
- using System;
- using System.Diagnostics;
- using System.Threading;
- namespace Renci.SshNet.Tests.SshClientTests
- {
- /// <summary>
- /// Summary description for UnitTest1
- /// </summary>
- [TestClass]
- public partial class ForwardedPortRemoteTest : TestBase
- {
- [TestMethod]
- public void Test_PortForwarding_Remote()
- {
- // ******************************************************************
- // ************* Tests are still in not finished ********************
- // ******************************************************************
- using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
- {
- client.Connect();
- var port1 = new ForwardedPortRemote(8082, "www.renci.org", 80);
- client.AddForwardedPort(port1);
- port1.Exception += delegate(object sender, ExceptionEventArgs e)
- {
- Assert.Fail(e.Exception.ToString());
- };
- port1.Start();
- var boundport = port1.BoundPort;
- System.Threading.Tasks.Parallel.For(0, 5,
- //new ParallelOptions
- //{
- // MaxDegreeOfParallelism = 1,
- //},
- (counter) =>
- {
- var cmd = client.CreateCommand(string.Format("wget -O- http://localhost:{0}", boundport));
- var result = cmd.Execute();
- var end = DateTime.Now;
- Debug.WriteLine(string.Format("Length: {0}", result.Length));
- }
- );
- Thread.Sleep(1000 * 100);
- port1.Stop();
- }
- }
- }
- }
|