_logger.debug("ConnectionTune frame received");
final AMQProtocolSession session = stateManager.getProtocolSession();
final MethodRegistry methodRegistry = session.getMethodRegistry();
ConnectionTuneParameters params = session.getConnectionTuneParameters();
if (params == null)
{
params = new ConnectionTuneParameters();
}
params.setFrameMax(frame.getFrameMax());
params.setChannelMax(frame.getChannelMax());
params.setHeartbeat(Integer.getInteger("amqj.heartbeat.delay", frame.getHeartbeat()));
session.setConnectionTuneParameters(params);
stateManager.changeState(AMQState.CONNECTION_NOT_OPENED);
ConnectionTuneOkBody tuneOkBody = methodRegistry.createConnectionTuneOkBody(params.getChannelMax(),
params.getFrameMax(),
params.getHeartbeat());
// Be aware of possible changes to parameter order as versions change.
session.writeFrame(tuneOkBody.generateFrame(channelId));
String host = session.getAMQConnection().getVirtualHost();
AMQShortString virtualHost = new AMQShortString("/" + host);