public static AmqpTestFramework WithDefaultSecurityNegotiation(this AmqpTestFramework testFramework, TimeSpan heartbeatInterval = default) { heartbeatInterval = heartbeatInterval == default ? TimeSpan.FromSeconds(DefaultHeartbeatIntervalInSeconds) : heartbeatInterval; return(testFramework .On <Connection.StartOk>((connectionId, frame) => testFramework.Send(connectionId, new MethodFrame <Connection.Secure>(frame.Channel, new Connection.Secure { Challenge = Longstr.From(Encoding.UTF8.GetBytes("challenge")) }))) .On <Connection.SecureOk>((connectionId, frame) => testFramework.Send(connectionId, new MethodFrame <Connection.Tune>(frame.Channel, new Connection.Tune { ChannelMax = Short.From(0), FrameMax = Long.From(0), Heartbeat = Short.From((short)(heartbeatInterval.TotalMilliseconds / 1000)) })))); }