class DummyAssociation(object):
    def __init__(self):
        self.ae = AE()
        self.mode = None
        self.dul = DummyDUL()
        self.requestor = ServiceUser(self, 'requestor')
        self.requestor.port = 11112
        self.requestor.ae_title = b'TEST_LOCAL      '
        self.requestor.address = '127.0.0.1'
        self.requestor.maximum_length = 31682
        self.acceptor = ServiceUser(self, 'acceptor')
        self.acceptor.ae_title = b'TEST_REMOTE     '
        self.acceptor.port = 11113
        self.acceptor.address = '127.0.0.2'
        self.acse_timeout = 11
        self.dimse_timeout = 1
        self.network_timeout = 13
        self.is_killed = False
        self.is_aborted = False
        self.is_established = False
        self.is_rejected = False
        self.is_released = False
        self.is_acceptor = False
        self.is_requestor = True
        self._handlers = {}

    def abort(self):
        self.is_aborted = True
        self.kill()

    def kill(self):
        self.is_killed = True

    @property
    def requested_contexts(self):
        return self.requestor.get_contexts('requested')

    @property
    def supported_contexts(self):
        return self.requestor.get_contexts('supported')

    def get_handlers(self, event):
        if event not in self._handlers:
            return []

        return self._handlers[event]
 def __init__(self):
     self.ae = AE()
     self.mode = None
     self.dul = DummyDUL()
     self.requestor = ServiceUser(self, 'requestor')
     self.requestor.port = 11112
     self.requestor.ae_title = b'TEST_LOCAL      '
     self.requestor.address = '127.0.0.1'
     self.requestor.maximum_length = 31682
     self.acceptor = ServiceUser(self, 'acceptor')
     self.acceptor.ae_title = b'TEST_REMOTE     '
     self.acceptor.port = 11113
     self.acceptor.address = '127.0.0.2'
     self.acse_timeout = 11
     self.dimse_timeout = 1
     self.network_timeout = 13
     self.is_killed = False
     self.is_aborted = False
     self.is_established = False
     self.is_rejected = False
     self.is_released = False
     self.is_acceptor = False
     self.is_requestor = True
     self._handlers = {}