Inheritance: RabbitMQ.Client.DefaultBasicConsumer
        public static int Main(string[] args)
        {
            try
            {
                if (args.Length < 1)
                {
                    Console.Error.WriteLine("Usage: ExceptionTest <uri>");
                    Console.Error.WriteLine("RabbitMQ .NET client version " + typeof(IModel).Assembly.GetName().Version);
                    Console.Error.WriteLine("Parameters:");
                    Console.Error.WriteLine("  <uri> = \"amqp://*****:*****@host:port/vhost\"");
                    return(2);
                }

                string serverAddress     = args[0];
                var    connectionFactory = new ConnectionFactory {
                    Uri = serverAddress
                };

                using (IConnection connection = connectionFactory.CreateConnection())
                {
                    connection.ConnectionShutdown += OnConnectionShutdownFirst;
                    connection.ConnectionShutdown += OnConnectionShutdown;
                    connection.ConnectionShutdown += OnConnectionShutdownSecond;
                    connection.CallbackException  += OnCallbackException;

                    using (IModel model = connection.CreateModel())
                    {
                        model.ModelShutdown     += OnModelShutdownFirst;
                        model.ModelShutdown     += OnModelShutdown;
                        model.ModelShutdown     += OnModelShutdownSecond;
                        model.CallbackException += OnCallbackException;

                        string queueName = model.QueueDeclare();

                        var    consumer    = new ThrowingConsumer(model);
                        string consumerTag = model.BasicConsume(queueName, false, consumer);
                        model.BasicPublish("", queueName, null, Encoding.UTF8.GetBytes("test"));
                        model.BasicCancel(consumerTag);
                        return(0);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("-=-=-=-=-= MAIN EXCEPTION CATCHER");
                Console.Error.WriteLine(ex);
                return(1);
            }
        }
        public static int Main(string[] args)
        {
            try {
                if (args.Length < 1)
                {
                    Console.Error.WriteLine("Usage: ExceptionTest <uri>");
                    Console.Error.WriteLine("RabbitMQ .NET client version " + typeof(IModel).Assembly.GetName().Version.ToString());
                    Console.Error.WriteLine("Parameters:");
                    Console.Error.WriteLine("  <uri> = \"amqp://*****:*****@host:port/vhost\"");
                    return(2);
                }

                string            serverAddress = args[0];
                ConnectionFactory cf            = new ConnectionFactory();
                cf.Uri = serverAddress;

                using (IConnection conn = cf.CreateConnection())
                {
                    conn.ConnectionShutdown += new ConnectionShutdownEventHandler(First);
                    conn.ConnectionShutdown += new ConnectionShutdownEventHandler(OnConnectionShutdown);
                    conn.ConnectionShutdown += new ConnectionShutdownEventHandler(Second);
                    conn.CallbackException  += new CallbackExceptionEventHandler(OnCallbackException);

                    using (IModel ch = conn.CreateModel()) {
                        ch.ModelShutdown     += new ModelShutdownEventHandler(First);
                        ch.ModelShutdown     += new ModelShutdownEventHandler(OnModelShutdown);
                        ch.ModelShutdown     += new ModelShutdownEventHandler(Second);
                        ch.CallbackException += new CallbackExceptionEventHandler(OnCallbackException);

                        string queueName = ch.QueueDeclare();

                        ThrowingConsumer consumer    = new ThrowingConsumer(ch);
                        string           consumerTag = ch.BasicConsume(queueName, false, consumer);
                        ch.BasicPublish("", queueName, null, Encoding.UTF8.GetBytes("test"));
                        ch.BasicCancel(consumerTag);
                        return(0);
                    }
                }
            } catch (Exception e) {
                Console.Error.WriteLine("-=-=-=-=-= MAIN EXCEPTION CATCHER");
                Console.Error.WriteLine(e);
                return(1);
            }
        }
        public static int Main(string[] args) {
            try {
                if (args.Length < 1) {
                    Console.Error.WriteLine("Usage: ExceptionTest <uri>");
                    Console.Error.WriteLine("RabbitMQ .NET client version "+typeof(IModel).Assembly.GetName().Version.ToString());
                    Console.Error.WriteLine("Parameters:");
                    Console.Error.WriteLine("  <uri> = \"amqp://*****:*****@host:port/vhost\"");
                    return 2;
                }

                string serverAddress = args[0];
                ConnectionFactory cf = new ConnectionFactory();
                cf.Uri = serverAddress;

                using (IConnection conn = cf.CreateConnection())
                {
                    conn.ConnectionShutdown += new ConnectionShutdownEventHandler(First);
                    conn.ConnectionShutdown += new ConnectionShutdownEventHandler(OnConnectionShutdown);
                    conn.ConnectionShutdown += new ConnectionShutdownEventHandler(Second);
                    conn.CallbackException += new CallbackExceptionEventHandler(OnCallbackException);

                    using (IModel ch = conn.CreateModel()) {
                        ch.ModelShutdown += new ModelShutdownEventHandler(First);
                        ch.ModelShutdown += new ModelShutdownEventHandler(OnModelShutdown);
                        ch.ModelShutdown += new ModelShutdownEventHandler(Second);
                        ch.CallbackException += new CallbackExceptionEventHandler(OnCallbackException);

                        string queueName = ch.QueueDeclare();

                        ThrowingConsumer consumer = new ThrowingConsumer(ch);
                        string consumerTag = ch.BasicConsume(queueName, false, consumer);
                        ch.BasicPublish("", queueName, null, Encoding.UTF8.GetBytes("test"));
                        ch.BasicCancel(consumerTag);
                        return 0;
                    }
                }
            } catch (Exception e) {
                Console.Error.WriteLine("-=-=-=-=-= MAIN EXCEPTION CATCHER");
                Console.Error.WriteLine(e);
                return 1;
            }
        }