Skip to content

Commit

Permalink
Try to "fix" the flaky test (sshnet#1185)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob-Hague authored Sep 25, 2023
1 parent aade354 commit 51e0c67
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public void ForwardedPortShouldAcceptNewConnections()
new ForwardedTcpipChannelInfo(_forwardedPort.BoundHost, _forwardedPort.BoundPort, originatorAddress,
originatorPort))));

// CreateChannelForwardedTcpip gets called on a separate thread.
// Sleep on this thread briefly to avoid a race.
Thread.Sleep(500);

_sessionMock.Verify(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize), Times.Once);
channelMock.Verify(p => p.Bind(It.Is<IPEndPoint>(ep => ep.Address.Equals(_remoteEndpoint.Address) && ep.Port == _remoteEndpoint.Port), _forwardedPort), Times.Once);
channelMock.Verify(p => p.Dispose(), Times.Once);
Expand Down

0 comments on commit 51e0c67

Please sign in to comment.