Relax registration checks for same servers somewhat.

If a server with the same ServerInfo is attempting to be re-registered,
we will return the existing registered server, which is less surprising
behavior than before.
This commit is contained in:
Andrew Steinborn
2018-10-21 20:03:38 -04:00
parent 3bd48dec99
commit f6cac0f50a
2 changed files with 17 additions and 2 deletions

View File

@@ -35,4 +35,12 @@ class ServerMapTest {
ServerInfo willReject = new ServerInfo("TESTSERVER", TEST_ADDRESS);
assertThrows(IllegalArgumentException.class, () -> map.register(willReject));
}
@Test
void allowsSameServerLaxRegistrationCheck() {
ServerMap map = new ServerMap(null);
ServerInfo info = new ServerInfo("TestServer", TEST_ADDRESS);
RegisteredServer connection = map.register(info);
assertEquals(connection, map.register(info));
}
}