Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#15] Fix Writing data on closed socket causes exceptions #18

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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ target/
.classpath
.project
.settings/

.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,11 @@ public WindowFuture<Integer,PduRequest,PduResponse> sendRequestPdu(PduRequest pd
}
}

if (!this.channel.isOpen()) {
logger.info("Channel closed.");
return future;
}

// we need to log the PDU after encoding since some things only happen
// during the encoding process such as looking up the result message
if (configuration.getLoggingOptions().isLogPduEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import com.cloudhopper.smpp.type.SmppChannelException;
import com.cloudhopper.smpp.type.SmppProcessingException;
import java.util.HashSet;

import com.cloudhopper.smpp.type.SmppTimeoutException;
import org.junit.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -456,9 +458,9 @@ public void serverSessionTimesOutWithNoBindRequest() throws Exception {
BaseBind bindRequest = client0.createBindRequest(sessionConfig0);

try {
BaseBindResp bindResponse = session0.bind(bindRequest, 200);
BaseBindResp bindResponse = session0.bind(bindRequest, 50);
Assert.fail();
} catch (SmppChannelException e) {
} catch (SmppTimeoutException e) {
// correct behavior
}

Expand Down