Skip to content

Commit

Permalink
Clarify reconnect behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
broneill committed Oct 6, 2024
1 parent 91a1ce4 commit 9a5f31b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/cojen/dirmi/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ void connected(SocketAddress localAddr, SocketAddress remoteAddr,
void addStateListener(BiPredicate<Session<?>, Throwable> listener);

/**
* Closes all connections and initiates a reconnect.
* Closes all connections and initiates a reconnect. Operation has no effect if the session
* is closed.
*/
void reconnect();

Expand Down
10 changes: 10 additions & 0 deletions src/test/java/org/cojen/dirmi/RestorableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ public boolean test(Session<?> session, Throwable ex) {
}

assertTrue(listener.reconnected);

mSession.close();

mSession.reconnect();

try {
r1x.echo("world");
fail();
} catch (ClosedException e) {
}
}

@Test
Expand Down

0 comments on commit 9a5f31b

Please sign in to comment.