Make connection.tune.channel_max configurable
Add channel_max default
No need to handle undefined case here
Extract function, improve error messages
Pass socket around instead of the entire state
Refactor

 * Passing State allows the function take one less argument
Extract function
Don't send connection.close when connection.tune negotiation fails

This keeps us spec-compliant. It only happens with bogus clients and
there will be a sensible error message in the log.

Per discussion with Simon.
Eliminate warnings
various fixes and refactors
- replace two 'case's with one
- the opposite of 'lower' is not 'greater' but 'higher'
- eliminate unnecessary intermediate var
- use rabbit_misc:protocol_error/4 instead of
  rabbit_misc:protocol_error/1 + rabbit_misc:amqp_error/4
- don't use ~p unnecessarily
refactor
- more sensible order of arguments
- less vertical space
(really) don't use ~p unnecessarily
refactor: make handling of server config values more generic
and shrink the code as a result
refactor: consistent order of handling configurable params
cosmetic: reduce vertical space and distance to default
Set CHANNEL_MIN to 1
Reject channel.open method with channel number > negotiated channel_max
Update config example
Reject channel.open when the total number of open channel goes above channel_max
Automated merge with ssh://rabbit-hg.eng.vmware.com/rabbitmq-server