// initiate bind requests on all sessions we care about -- this should
// technicaly "starve" the server of worker threads since they'll all
// be blocked in a Thread.sleep
for (int i = 0; i < workersToStarveWith; i++) {
DefaultSmppClient client0 = new DefaultSmppClient();
SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration();
sessionConfig0.setName("WorkerTest.Session." + i);
// don't use default method of binding, connect the socket first
DefaultSmppSession session0 = client0.doOpen(sessionConfig0, new DefaultSmppSessionHandler());
// try to bind and execute a bind request and wait for a bind response
BaseBind bindRequest = client0.createBindRequest(sessionConfig0);
try {
// just send the request without caring if it succeeds
session0.sendRequestPdu(bindRequest, 2000, false);
} catch (SmppChannelException e) {
// correct behavior
}
}
// now try to bind normally -- since all previous workers are "starved"
// this should fail to bind and the socket closed by the "BindTimer"
DefaultSmppClient client0 = new DefaultSmppClient();
SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration();
sessionConfig0.setName("WorkerTestChannelClosed.Session");
sessionConfig0.setBindTimeout(750);
try {
client0.bind(sessionConfig0);
Assert.fail();
} catch (SmppChannelException e) {