MinaConnectStateListener connect = new MinaConnectStateListener();
connect.setGateway(gateway);
gateway.addMessageListener(connect);
MinaHeartbeatListener heartbeat = new MinaHeartbeatListener();
heartbeat.setHeartbeatContainer(heartbeatContainer);
heartbeat.setGateway(gateway);
gateway.addMessageListener(heartbeat);
MinaTransactionListener transaction = new MinaTransactionListener();
transaction.setGateway(gateway);
gateway.addMessageListener(transaction);