< 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: 275_13775359185
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/>
 121412    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)
 99022    {
 99023        if (serverAuthenticationOptions is not null)
 024        {
 025            throw new NotSupportedException("The Coloc server transport does not support SSL.");
 26        }
 27
 99028        if ((serverAddress.Transport is string transport && transport != Name) ||
 99029            !ColocTransport.CheckParams(serverAddress))
 430        {
 431            throw new ArgumentException(
 432                $"The server address '{serverAddress}' contains parameters that are not valid for the Coloc server trans
 433                nameof(serverAddress));
 34        }
 35
 98636        var listener = new ColocListener(
 98637            serverAddress with { Transport = Name },
 98638            colocTransportOptions: _options,
 98639            duplexConnectionOptions: options);
 40
 98641        if (!_listeners.TryAdd(listener.ServerAddress, listener))
 442        {
 443            throw new IceRpcException(IceRpcError.AddressInUse);
 44        }
 98245        return listener;
 98246    }
 47
 97848    internal ColocServerTransport(
 97849        ConcurrentDictionary<ServerAddress, ColocListener> listeners,
 97850        ColocTransportOptions options)
 97851    {
 97852        _listeners = listeners;
 97853        _options = options;
 97854    }
 55}