diff --git a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java index c4975890..5896ab45 100644 --- a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java +++ b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java @@ -507,6 +507,11 @@ public WindowFuture sendRequestPdu(PduRequest pd } } + if (!this.channel.isOpen()) { + logger.info("Channel closed."); + return future; + } + // write the pdu out & wait timeout amount of time ChannelFuture channelFuture = this.channel.writeAndFlush(buffer); if (configuration.getWriteTimeout() > 0){ diff --git a/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppServerTest.java b/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppServerTest.java index 9963d1bb..ab51f681 100644 --- a/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppServerTest.java +++ b/src/test/java/com/cloudhopper/smpp/impl/DefaultSmppServerTest.java @@ -461,8 +461,9 @@ public void serverSessionTimesOutWithNoBindRequest() throws Exception { try { BaseBindResp bindResponse = session0.bind(bindRequest, 200); Assert.fail(); - } catch (SmppChannelException e) { + } catch (SmppTimeoutException e) { // correct behavior + logger.debug("Got expected timeout exception {}", e.getMessage()); } // verify everything after the session timed out