< Summary

Information
Class: IceRpc.Transports.Quic.QuicServerTransport
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Quic/QuicServerTransport.cs
Tag: 1321_24790053727
Line coverage
58%
Covered lines: 18
Uncovered lines: 13
Coverable lines: 31
Total lines: 72
Line coverage: 58%
Branch coverage
57%
Covered branches: 8
Total branches: 14
Branch coverage: 57.1%
Method coverage
100%
Covered methods: 4
Fully covered methods: 3
Total methods: 4
Method coverage: 100%
Full method coverage: 75%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_DefaultName()100%11100%
.ctor(...)100%11100%
.ctor()100%11100%
Listen(...)57.14%391450%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Quic/QuicServerTransport.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Transports.Quic.Internal;
 4using System.Net.Quic;
 5using System.Net.Security;
 6using System.Runtime.Versioning;
 7
 8namespace IceRpc.Transports.Quic;
 9
 10/// <summary>Implements <see cref="IMultiplexedServerTransport"/> using QUIC.</summary>
 11[SupportedOSPlatform("linux")]
 12[SupportedOSPlatform("macos")]
 13[SupportedOSPlatform("windows")]
 14public class QuicServerTransport : IMultiplexedServerTransport
 15{
 16    /// <inheritdoc/>
 717    public string DefaultName => "quic";
 18
 19    private readonly QuicServerTransportOptions _quicOptions;
 20
 21    /// <summary>Constructs a QUIC server transport.</summary>
 22    /// <param name="options">The options to configure the transport.</param>
 24623    public QuicServerTransport(QuicServerTransportOptions options) => _quicOptions = options;
 24
 25    /// <summary>Constructs a QUIC server transport.</summary>
 26    public QuicServerTransport()
 127        : this(new QuicServerTransportOptions())
 128    {
 129    }
 30
 31    /// <inheritdoc/>
 32    public IListener<IMultiplexedConnection> Listen(
 33        TransportAddress transportAddress,
 34        MultiplexedConnectionOptions options,
 35        SslServerAuthenticationOptions? serverAuthenticationOptions)
 12736    {
 12737        if (!QuicListener.IsSupported)
 038        {
 039            throw new NotSupportedException(
 040                "The QUIC server transport is not available on this system. Please review the Platform Dependencies for 
 41        }
 42
 12743        if (transportAddress.TransportName is string name && name != DefaultName)
 044        {
 045            throw new NotSupportedException($"The QUIC server transport does not support transport '{name}'.");
 46        }
 47
 12748        if (transportAddress.Params.Count > 0)
 149        {
 150            throw new ArgumentException(
 151                "The transport address contains parameters that are not valid for the QUIC server transport.",
 152                nameof(transportAddress));
 53        }
 54
 12655        if (serverAuthenticationOptions is null)
 056        {
 057            throw new ArgumentNullException(
 058                nameof(serverAuthenticationOptions),
 059                "The QUIC server transport requires the SSL server authentication options to be set.");
 60        }
 61
 12662        if (serverAuthenticationOptions.ApplicationProtocols
 12663            is not List<SslApplicationProtocol> applicationProtocols || applicationProtocols.Count == 0)
 064        {
 065            throw new ArgumentException(
 066                "The QUIC server transport requires ApplicationProtocols to be set in the SSL server authentication opti
 067                nameof(serverAuthenticationOptions));
 68        }
 69
 12670        return new QuicMultiplexedListener(transportAddress, options, _quicOptions, serverAuthenticationOptions);
 12571    }
 72}