Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

#93 the session is closed when the channel is (2) #96

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ public void fireChannelClosed() {
// do nothing -- ignore it
logger.debug("Unbind/close was requested, ignoring channelClosed event");
} else {
this.state.set(STATE_CLOSED);
this.sessionHandler.fireChannelUnexpectedlyClosed();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ public void closeDoesNotTriggerUnexpectedlyClosedEvent() throws Exception {

Assert.assertEquals(0, sessionHandler.getClosedCount());
Assert.assertEquals(false, session.isBound());
Assert.assertEquals(true, session.isClosed());
}


Expand All @@ -650,6 +651,7 @@ public void unbindWithNoResponseDoesNotTriggerUnexpectedlyClosedEvent() throws E

Assert.assertEquals(0, sessionHandler.getClosedCount());
Assert.assertEquals(false, session.isBound());
Assert.assertEquals(true, session.isClosed());
}

@Test
Expand All @@ -676,6 +678,7 @@ public boolean process(SmppSimulatorSessionHandler session, Channel channel, Pdu

Assert.assertEquals(0, sessionHandler.getClosedCount());
Assert.assertEquals(false, session.isBound());
Assert.assertEquals(true, session.isClosed());
}

@Test
Expand Down Expand Up @@ -730,8 +733,9 @@ public void remoteCloseDoesTriggerUnexpectedlyClosedEvent() throws Exception {
Thread.sleep(500);

Assert.assertEquals(1, sessionHandler.getClosedCount());
// DEFAULT handling is that we don't do anything special with this...
Assert.assertEquals(true, session.isBound());
// the session is closed when the channel is
Assert.assertEquals(false, session.isBound());
Assert.assertEquals(true, session.isClosed());

// unbind the session now -- this should work okay even though the channel is closed
session.unbind(100);
Expand Down