package org.jsmpp.session;

import org.jsmpp.bean.Bind;
import org.jsmpp.bean.QuerySm;
import org.jsmpp.bean.SubmitSm;
import org.jsmpp.extra.ProcessRequestException;
import org.jsmpp.util.MessageId;

public class ServerResponseHandler {

    public MessageId processSubmitSm(ServerSession session, SubmitSm submitSm) throws ProcessRequestException {
        MessageId messageId = session.getMessageReceiverListener().onAcceptSubmitSm(submitSm);
        session.getPDUSender().sendSubmitSmResp(submitSm, messageId);
        return messageId;
    }

    public QuerySmResult processQuerySm(ServerSession session, QuerySm querySm) throws ProcessRequestException {
        QuerySmResult res = session.getMessageReceiverListener().onAcceptQuerySm(querySm);
        session.getPDUSender().sendQuerySmResp(querySm, res);
        return res;
    }

    public void processBind(ServerSession session, Bind bind) {
        session.getBindRequestReceiver().notifyAcceptBind(session.getSessionState(), bind);
    }
}
@@ -197,45 +197,197 @@
 Id;%0A
-%0Apublic class ServerResponseHandler %7B
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Apublic class ServerResponseHandler %7B%0A    private static final Logger logger = LoggerFactory.getLogger(ServerResponseHandler.class);
 %0A%0A  
@@ -508,66 +508,206 @@
     
+Server
 Message
-Id messageId = session.getMessageReceiverListener()
+ReceiverListener messageReceiverListener = session.getMessageReceiverListener();%0A        if (messageReceiverListener != null) %7B%0A            MessageId messageId = messageReceiverListener
 .onA
@@ -727,24 +727,28 @@
 (submitSm);%0A
+    
         sess
@@ -809,24 +809,28 @@
 d);%0A        
+    
 return messa
@@ -843,188 +843,471 @@
     
-%7D%0A%0A    public QuerySmResult processQuerySm(ServerSession session, QuerySm querySm) throws ProcessRequestException %7B%0A        QuerySmResult res = session.getMessageReceiverListener()
+    %7D%0A        logger.debug(%22ServerResponseHandler received submit_sm, but ServerMessageReceiverListener is not set%22);%0A        return null;%0A    %7D%0A%0A    public QuerySmResult processQuerySm(ServerSession session, QuerySm querySm) throws ProcessRequestException %7B%0A        ServerMessageReceiverListener messageReceiverListener = session.getMessageReceiverListener();%0A        if (messageReceiverListener != null) %7B%0A            QuerySmResult res = messageReceiverListener
 .onA
@@ -1325,24 +1325,28 @@
 m(querySm);%0A
+    
         sess
@@ -1399,24 +1399,28 @@
 s);%0A        
+    
 return res;%0A
@@ -1419,16 +1419,158 @@
 rn res;%0A
+        %7D%0A        logger.debug(%22ServerResponseHandler received query_sm, but ServerMessageReceiverListener is not set%22);%0A        return null;%0A
     %7D%0A%0A 

make ServerMessageReceiverListener nullable