@Override
  public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause)
      throws Exception {
    if (!active) {
      return;
    }
    // We don't want to log this - since it is normal for this to happen during failover/reconnect
    // and we don't want to spew out stack traces in that event
    // The user has access to this exeception anyway via the ActiveMQException initial cause

    ActiveMQException me = ActiveMQClientMessageBundle.BUNDLE.nettyError();
    me.initCause(cause);

    synchronized (listener) {
      try {
        listener.connectionException(channelId(ctx.channel()), me);
        active = false;
      } catch (Exception ex) {
        ActiveMQClientLogger.LOGGER.errorCallingLifeCycleListener(ex);
      }
    }
  }