AMQShortString reason = method.getReplyText();
try
{
ConnectionCloseOkBody closeOkBody = session.getMethodRegistry().createConnectionCloseOkBody();
// TODO: check whether channel id of zero is appropriate
// Be aware of possible changes to parameter order as versions change.
session.writeFrame(closeOkBody.generateFrame(0));
if (errorCode != AMQConstant.REPLY_SUCCESS)
{
if (errorCode == AMQConstant.NOT_ALLOWED || (errorCode == AMQConstant.ACCESS_REFUSED))
{