code: public void connectionClosed(RTMPConnection conn) {
          log.debug("connectionClosed: {}", conn.getSessionId());
          if (conn.getStateCode() != RTMP.STATE_DISCONNECTED) {
              // inform any callbacks for pending calls that the connection is closed
              conn.sendPendingServiceCallsCloseError();
              // close the connection
              if (conn.getStateCode() != RTMP.STATE_DISCONNECTING) {
                  conn.close();
              }
              // set as disconnected
              conn.setStateCode(RTMP.STATE_DISCONNECTED);
          }
          IoSession session = conn.getIoSession();
          if (session != null && session.containsAttribute(RTMPConnection.RTMP_CONN_MANAGER)) {
              @SuppressWarnings("unchecked")
              IConnectionManager<RTMPConnection> connManager = (IConnectionManager<RTMPConnection>) ((WeakReference<?>) session.getAttribute(RTMPConnection.RTMP_CONN_MANAGER)).get();
              if (connManager != null) {
                  connManager.removeConnection(conn.getSessionId());
              } else {
                  log.debug("Connection manager was not found in the session");
              }
          }
          log.trace("connectionClosed: {}", conn);
      }
docs: {@inheritDoc}