Merge pull request #1 from kostousov-ds/master

mavenize
Fix failure message in StringValidationTest unit test (incorrect length indicated)
Add methods to ClientSession interface so that it can be used as a useful SMPP session. This allows creating objects that behave like SMPP sessions without subclassing the heavy-weight AbstractSession or SMPPSession classes.
Raise ProcessRequestException in fireAcceptDeliverSm() if there is no MessageReceiverListener set, otherwise the smpp server will receive an ok for a message that was not correctly delivered
Use readFully() instead of read() for reading in DefaultPDUReader.readPDU(). Under some network conditions, it is possible for the code to receive a partial package over the socket and erronously throw an IOException for the socket. The specs for read() don't guarantee that the full requested length is read in one call. Using readFully() fixes that problem.
the method onStateChange() in an SessionStateListener interface always receives a session, so the passed object can be a Session instead of a generic Object
Retrieve state processor when task is run instead of when enqueued.

Change PDUProcessTask so that state processor is retrieved when task is actually executed, not when task is enqueued. This solves a race condition where the bind state changes while a task is enqueued
Fix race condition when session is being bound

When an smpp session is bound and there are messages waiting on the
smsc side, it is legal for the smsc to send a DeliverSM PDU immediately
after it sends a bind response. Because of the PduProcessorDegree,
there is a race condition were both the BindResp and the DeliverSM can
simultaniously be processed but the DeliverSM will be processed like
the session is still in the open state instead of the bound state. This
patch changes the size of the executorService pool to remove the race
condition. It starts with size 1 in open state and when the session is
bound, the pool will be enlarged to the PduProcessorDegree.
Refactored EnquireLinkTimer thread into AbstractSession

There was duplicate code in SMPPSession and SMPPServerSession that should live in AbstractSession.
Wait for EnquireLink thread to exit when closing

After the smpp session has been closed with close() method, we shouldn't leave any threads running. Any extra threads should have exited before Session.close() exits, otherwise many webapp containers will complain during webapp shutdown or webapp restart
Give EnquireLinkSender thread a name
PDUReaderWorker waits for termination of executor service
Give PDUReaderWorker thread a name
Preallocate correct size for StringBuffer in HexUtil
Merge pull request #2 from stefanth/master

cool bug fixes and enhanchments to some java interfaces
Add minor unit tests for HexUtil
Debug logging of raw SMPP PDUs

All PDUs received and sent over SMPP connection are now logged at debug level
Less chatter about activity/enquireLink on session

A different commit has added logging of all PDUs at debug level so here we reduce the log messages about activity or inactivity.
Respond correctly to failed DeliverSM

The SMPP specification specifically lists that a PDU body with a NULL field message_id is required in the deliver_sm_resp message. Using the sendNegativeResponse() will result in a body-less PDU response that some SMPP servers legitimately refuse with an error about invalid command length. Now we correctly send the deliver_sm_resp in case of a ProcessRequestException. For PDUStringException we now send a generick_nack instead of a deliver_sm_resp, just like in other cases were such an exception is thrown.
OptionalParameter can be retrieved by type