code: private void socketClosedHandler() {
          // If the book-keeping has already been completed earlier, then
          // we should just bail.
          if (getReadyState() == ReadyState.CLOSED) {
              return;
          }
          
          // TODO: Determine whether channels need to be cleaned up
          if (this.channels.size() != 0) {
              // Iterate over the channels and close them.
              for (int i = 1; i <= this.channels.size(); i++) { // 1-based
                  AmqpChannel channel = this.channels.get(i);
                  AmqpFrame   f = new AmqpFrame();
                  
                  // Close the channel and ensure that the CLOSE event is
                  // fired on the registered ChannelListener objects.
                  f.setMethodName("closeChannel");
                  f.setChannelId((short) i);
                  channel.channelClosedHandler(this, "", f, "closeChannel");
              }
          }
          
          // Mark the readyState as CLOSED.
          readyState = ReadyState.CLOSED;
  
          // Fire the CLOSE event on the ConnectionListener(s) registered on
          // the AmqpClient object.
          fireOnClosed(new ConnectionEvent(this, Kind.CLOSE));
      }
docs: closing the channels, raising events, and such.