mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-11 13:39:09 +00:00
5b8382de26
A byte array is allocated to hold each plaintext packet. This removes that by adding a buffer for that purpose.
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System.Net.Sockets;
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
using Renci.SshNet.Common;
|
|
using Renci.SshNet.Messages.Transport;
|
|
using Renci.SshNet.Tests.Common;
|
|
|
|
namespace Renci.SshNet.Tests.Classes
|
|
{
|
|
[TestClass]
|
|
public class SessionTest_Connecting_ServerSendsIgnoreMessageAfterKexInit_StrictKex : SessionTest_ConnectingBase
|
|
{
|
|
protected override bool ServerSupportsStrictKex
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
protected override void ActionAfterKexInit()
|
|
{
|
|
var ignoreMessage = new IgnoreMessage();
|
|
var ignore = ignoreMessage.GetPacket(8, null);
|
|
|
|
// MitM sends ignore message to client
|
|
_ = ServerSocket.Send(ignore, 4, ignore.Length - 4, SocketFlags.None);
|
|
|
|
// MitM drops server message
|
|
ServerOutboundPacketSequence++;
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ShouldThrowSshException()
|
|
{
|
|
var message = Assert.ThrowsExactly<SshException>(Session.Connect).Message;
|
|
Assert.AreEqual("Message type 2 is not valid in the current context.", message);
|
|
}
|
|
}
|
|
}
|