def establish_release
      @release = false
      if @abort
        @link.stop_session
        logger.info("Association has been closed. (#{@host_ae}, #{@host_ip})")
      else
        unless @link.session.closed?
          @link.build_release_request
          @link.transmit
          info = @link.receive_single_transmission.first
          @link.stop_session
          if info[:pdu] == PDU_RELEASE_RESPONSE
            logger.info("Association released properly from host #{@host_ae}.")
          else
            logger.error("Association released from host #{@host_ae}, but a release response was not registered.")
          end
        else
          logger.error("Connection was closed by the host (for some unknown reason) before the association could be released properly.")
        end
      end
      @abort = false
    end
def establish_release
      @release = false
      if @abort
        @link.stop_session
        logger.info("Association has been closed. (#{@host_ae}, #{@host_ip})")
      else
        unless @link.session.closed?
          @link.build_release_request
          @link.transmit
          info = @link.receive_single_transmission.first
          @link.stop_session
          if info[:pdu] == PDU_RELEASE_RESPONSE
            logger.info("Association released properly from host #{@host_ae}.")
          else
            logger.error("Association released from host #{@host_ae}, but a release response was not registered.")
          end
        else
          logger.error("Connection was closed by the host (for some unknown reason) before the association could be released properly.")
        end
      end
      @abort = false
    end
Handles the release request along with the response, as well as closing the TCP connection.