This commit is contained in:
ciomek committed 2026-09-19 20:39:12 +02:00
1 parent b954d9d448
commit 01f4c13954
22 files changed
+929 -170

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import socket
import threading
from pathlib import Path
from colony.core.roles.role import Role
from colony.transport.listener import Listener
REPO_ROOT = Path(__file__).resolve().parent.parent
CERT = str(REPO_ROOT / "certs" / "server.crt")
KEY = str(REPO_ROOT / "certs" / "server.key")
def free_port():
with socket.socket() as s:
s.bind(("127.0.0.1", 0))
return s.getsockname()[1]
def start_listener(dispatcher):
listener = Listener(dispatcher, host="127.0.0.1", port=0, cert_file=CERT, keyfile=KEY)
listener.bind()
threading.Thread(target=listener.start, daemon=True).start()
return listener
class StubRole(Role):
def __init__(self, context):
super().__init__({}, context)
class RoleA(StubRole):
pass
class RoleB(StubRole):
pass