Skip to content

Commit

Permalink
twitter-archive#93 the session is closed when the channel is
Browse files Browse the repository at this point in the history
  • Loading branch information
krasa committed Apr 18, 2015
1 parent 494b6f0 commit 0a2e5a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 0a2e5a7

Please sign in to comment.