Skip to content

Commit 76fb877

Browse files
sancheolzyallie
authored andcommitted
Added test to check timeout for waiting for goodbye, see #202
1 parent 79a19f7 commit 76fb877

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

CoreRemoting.Tests/SessionTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,33 @@ public virtual async Task Client_shouldnt_time_out_when_Disconnect_is_called_mor
246246
await Task.Delay(TimeSpan.FromSeconds(1)); // client gets close_session and disconnects
247247
await Task.Run(client.Dispose).Timeout(2); // client calls Dispose and disconnects
248248
}
249+
250+
[Fact]
251+
public virtual async Task Client_shouldnt_time_out_when_dispose_is_called_after_remote_disconnect()
252+
{
253+
_serverFixture.TestService.TestMethodFake = _ =>
254+
{
255+
RemotingSession.Current.Close();
256+
return null;
257+
};
258+
259+
using var client = new RemotingClient(new ClientConfig
260+
{
261+
ConnectionTimeout = 0,
262+
InvocationTimeout = 0,
263+
SendTimeout = 0,
264+
MessageEncryption = false,
265+
ServerPort = _serverFixture.Server.Config.NetworkPort,
266+
Channel = ClientChannel,
267+
WaitTimeForGoodbyeOnDisconnect = 100 //We will set such a timeout so that the client is guaranteed not to wait more than 3 seconds.
268+
});
269+
270+
client.Connect();
271+
272+
var proxy = client.CreateProxy<ITestService>();
273+
274+
proxy.TestMethod(null);// server sends close_session
275+
await Task.Run(client.Dispose).Timeout(3); // client calls Dispose and disconnects
276+
}
249277
}
250278

0 commit comments

Comments
 (0)