private TcpMetricsClientWrapper(IOutbountChannel channel, TimeSpan breathTime, IFormatter formatter, Func <Encoding> encodingFactory) : base(channel, breathTime, formatter, encodingFactory) { }
internal static TcpMetricsClientWrapper Stub(IOutbountChannel channel = null, IFormatter formatter = null, Func <Encoding> encodingFactory = null) { return(new TcpMetricsClientWrapper(channel ?? new Mock <IOutbountChannel>().Object, TimeSpan.FromMilliseconds(-1d), formatter ?? new Mock <IFormatter>().Object, encodingFactory ?? (() => new Mock <Encoding>().Object))); }
public static Task <IMetricsClient> StartAsync(IOutbountChannel channel, TimeSpan breathTime, IFormatter formatter = null, Func <Encoding> encodingFactory = null) { return(channel.ConnectAsync() .ContinueWithOrThrow(_ => (IMetricsClient) new TcpMetricsClient(channel, breathTime, formatter ?? new DefaultFormatter(), encodingFactory ?? (() => new UTF8Encoding(true))))); }
protected TcpMetricsClient(IOutbountChannel channel, TimeSpan breathTime, IFormatter formatter, Func <Encoding> encodingFactory) { _channel = channel; _breathTime = breathTime; _formatter = formatter; _encodingFactory = encodingFactory; _cts = new CancellationTokenSource(); BackgroundWorkAsync(_cts.Token); }
public static Task <IMetricsClient> StartAsync(IOutbountChannel channel, IFormatter formatter = null, Func <Encoding> encodingFactory = null) { return(StartAsync(channel, DefaultBreathTime, formatter, encodingFactory)); }