public async Task GatewayStopListen_StopListeningAndKeepActiveConnections(ChannelType type)
{
// Arrange
var gateway = CreatePrimaryGateway(type);
var clientChannel = await CreatePrimaryClientChannelAsync(type);
var entry = clientChannel.CreateRef<EntryRef>();
Assert.Equal("Test", await entry.Echo("Test"));
var serverChannel = (await ActorSelection(gateway.CastToIActorRef().Path + "/*").ResolveOne(TimeSpan.FromSeconds(1))).Cast<ActorBoundChannelRef>();
// Act & Assert (Stop listening and further channels cannot be established)
await gateway.Stop(true);
var exception = await Record.ExceptionAsync(() => CreatePrimaryClientChannelAsync(type));
Assert.NotNull(exception);
Assert.Equal("Test2", await entry.Echo("Test2"));
// Act & Assert (Stop all and all channels are closed)
await gateway.Stop();
Watch(serverChannel.CastToIActorRef());
ExpectTerminated(serverChannel.CastToIActorRef());
}