Simple code running in systemd exits to fast?
For socket activated services, you don't start the service file, you start the socket file.
systemctl enable --now kosmos.socket
Now systemd will listen on the specified port and pass incoming connections to the corresponding service, which it will also start itself.