private function isAddressValid(string $address): bool
    {
        $position = \strrpos($address, ':');
        if ($position === false) {
            return ($address[0] ?? '') === "\0"; // udg socket address.
        }

        $ip = \trim(\substr($address, 0, $position), '[]');
        $port = (int) \substr($address, $position + 1);

        return \inet_pton($ip) !== false && $port > 0 && $port < 65536;
    }