From eea933da35ca713b4a800785afa00b60a4fe4807 Mon Sep 17 00:00:00 2001 From: Vojtech Krasa Date: Sun, 19 Apr 2015 01:38:59 +0200 Subject: [PATCH] #93 the session is closed when the channel is --- .../java/com/cloudhopper/smpp/impl/DefaultSmppSession.java | 1 + .../com/cloudhopper/smpp/impl/DefaultSmppSessionTest.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java index 66ff11b7..632f753e 100644 --- a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java +++ b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java @@ -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(); } } diff --git a/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppSessionTest.java b/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppSessionTest.java index 05edc849..28e8b4f9 100644 --- a/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppSessionTest.java +++ b/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppSessionTest.java @@ -730,8 +730,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);