'Call before every test case.'

def setUp(self):

    super(SMTPActionTest, self).setUp()
    self.jail = DummyJail()
    pythonModule = os.path.join(CONFIG_DIR, 'action.d', 'smtp.py')
    pythonModuleName = os.path.basename(pythonModule.rstrip('.py'))
    if (sys.version_info >= (3, 3)):
        customActionModule = importlib.machinery.SourceFileLoader(pythonModuleName, pythonModule).load_module()
    else:
        customActionModule = imp.load_source(pythonModuleName, pythonModule)
    self.smtpd = TestSMTPServer(('localhost', 0), None)
    port = self.smtpd.socket.getsockname()[1]
    self.action = customActionModule.Action(self.jail, 'test', host=('localhost:%i' % port))
    self._active = True
    self._loop_thread = threading.Thread(target=asyncserver.loop, kwargs={'active': (lambda : self._active)})
    self._loop_thread.daemon = True
    self._loop_thread.start()
