< Summary

Information
Class: IceRpc.Transports.Coloc.Internal.ColocServerTransport
Assembly: IceRpc.Transports.Coloc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Coloc/Internal/ColocServerTransport.cs
Tag: 592_20856082467
Line coverage
92%
Covered lines: 25
Uncovered lines: 2
Coverable lines: 27
Total lines: 55
Line coverage: 92.5%
Branch coverage
80%
Covered branches: 8
Total branches: 10
Branch coverage: 80%
Method coverage
100%
Covered methods: 3
Total methods: 3
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
Listen(...)80%10.121089.47%
.ctor(...)100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Coloc/Internal/ColocServerTransport.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Collections.Concurrent;
 4using System.Net.Security;
 5
 6namespace IceRpc.Transports.Coloc.Internal;
 7
 8/// <summary>Implements <see cref="IDuplexServerTransport" /> for the coloc transport.</summary>
 9internal class ColocServerTransport : IDuplexServerTransport
 10{
 11    /// <inheritdoc/>
 63512    public string Name => ColocTransport.Name;
 13
 14    private readonly ConcurrentDictionary<ServerAddress, ColocListener> _listeners;
 15    private readonly ColocTransportOptions _options;
 16
 17    /// <inheritdoc/>
 18    public IListener<IDuplexConnection> Listen(
 19        ServerAddress serverAddress,
 20        DuplexConnectionOptions options,
 21        SslServerAuthenticationOptions? serverAuthenticationOptions)
 50522    {
 50523        if (serverAuthenticationOptions is not null)
 024        {
 025            throw new NotSupportedException("The Coloc server transport does not support SSL.");
 26        }
 27
 50528        if ((serverAddress.Transport is string transport && transport != Name) ||
 50529            !ColocTransport.CheckParams(serverAddress))
 230        {
 231            throw new ArgumentException(
 232                $"The server address '{serverAddress}' contains parameters that are not valid for the Coloc server trans
 233                nameof(serverAddress));
 34        }
 35
 50336        var listener = new ColocListener(
 50337            serverAddress with { Transport = Name },
 50338            colocTransportOptions: _options,
 50339            duplexConnectionOptions: options);
 40
 50341        if (!_listeners.TryAdd(listener.ServerAddress, listener))
 242        {
 243            throw new IceRpcException(IceRpcError.AddressInUse);
 44        }
 50145        return listener;
 50146    }
 47
 49748    internal ColocServerTransport(
 49749        ConcurrentDictionary<ServerAddress, ColocListener> listeners,
 49750        ColocTransportOptions options)
 49751    {
 49752        _listeners = listeners;
 49753        _options = options;
 49754    }
 55}