+ assert(success);
+ int newport = meshlink_get_port(mesh1);
+ assert(oldport != newport);
+
+ assert(meshlink_start(mesh1));
+ quux_url = meshlink_invite(mesh1, NULL, "quux");
+ assert(quux_url);
+
+ // The old port should not be in the invitation URL
+
+ char portstr[10];
+ snprintf(portstr, sizeof(portstr), ":%d", oldport);
+ assert(!strstr(quux_url, portstr));
+
+ // The new port should be in the invitation URL
+
+ snprintf(portstr, sizeof(portstr), ":%d", newport);
+ assert(strstr(quux_url, portstr));
+
+ // The invitation should work
+
+ assert(meshlink_join(mesh3, quux_url));
+ free(quux_url);
+
+ // Check that adding duplicate addresses get removed correctly
+
+ assert(meshlink_add_invitation_address(mesh1, "localhost", portstr + 1));
+ corge_url = meshlink_invite(mesh1, NULL, "corge");
+ assert(corge_url);
+ char *localhost = strstr(corge_url, "localhost");
+ assert(localhost);
+ assert(!strstr(localhost + 1, "localhost"));