public async Task Send_async_unsplittable_oversized_udp_packets_are_not_split_or_sent_and_no_exception_is_raised() { // This message will be one byte longer than the theoretical limit of a UDP packet var msg = new string('f', 65508); _listenThread.Start(); _statsd.Add <Statsd.Counting, int>(msg, 1); await _statsd.SendAsync(); // It shouldn't be split or sent, and no exceptions should be raised. AssertWasReceived(null); }
public async Task Async_set_max_udp_packet_size() { // Make sure that we can set the max UDP packet size _udp = new StatsdUDP(_serverName, _serverPort, 10); var oldStatsd = _statsd; try { _statsd = new Statsd(_udp); var msg = new string('f', 5); _listenThread.Start(2); _statsd.Add <Statsd.Counting, int>(msg, 1); _statsd.Add <Statsd.Gauge, int>(msg, 2); await _statsd.SendAsync(); // Since our packet size limit is now 10, this (short) message should still be split AssertWasReceived(string.Format("{0}:1|c", msg), 0); AssertWasReceived(string.Format("{0}:2|g", msg), 1); } finally { // reset statsd, so we don't get stuck with max size of 10 for other tests _statsd = oldStatsd; } }