((AMQConnection) _connection).setConnectionListener(this);
_connection.setExceptionListener(this);
// Change the StateManager for one that doesn't respond with Close-OKs
AMQStateManager oldStateManager = ((AMQConnection) _connection).getProtocolHandler().getStateManager();
_session = _connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
_connection.start();
// Test connection
checkSendingMessage();
// Set StateManager to manager that ignores Close-oks
AMQProtocolSession protocolSession = ((AMQConnection) _connection).getProtocolHandler().getProtocolSession();
AMQStateManager newStateManager = new NoCloseOKStateManager(protocolSession);
newStateManager.changeState(oldStateManager.getCurrentState());
((AMQConnection) _connection).getProtocolHandler().setStateManager(newStateManager);
final int TEST_CHANNEL = 1;
_logger.info("Testing Channel(" + TEST_CHANNEL + ") Creation");