Closed chris6366 closed 3 years ago
Oops. What would you say is the intuitive outcome for calling login when already logged in - return, return and warn, or throw?
Idempotent I'd say... if you attempt to close a Closeable that's already closed, it just returns. So if you attempt to login while already logged in, just return. At least that's what I do in the Battlelog library when it comes to logging in.
https://github.com/TheLastRefuge/Jarcon/blob/dd11e55d894f78ecfa2f7eedc2fbf4ea3f940534/src/test/java/gg/tlr/jarcon/TestEnv.java#L26-L27
client.login().get();
throws because JarconClient:doLogin is already called throughclient.connect().get();
. On the second attempt it readsStatus.LOGGED_IN
while checking forStatus.CONNECTED
and then throws IllegalStateException. Several ways to fix but I'm not sure how you intended this.