     {:noreply, new_st}
   end
 
+  def handle_cast(:stop, st) do
+    Session.stop(st.session)
+    {:noreply, st}
+  end
+
+  def handle_cast({:cast, request}, st) do
+    new_module_state = st.module.handle_cast(request, st.module_state)
+    new_st = %ESME{ st | module_state: new_module_state }
+    {:noreply, new_st}
+  end
+
   def handle_info({:tick, time}, st) do
     do_handle_tick(time, st)
+  end
+
+  def handle_info({:info, request}, st) do
+    new_module_state = st.module.handle_info(request, st.module_state)
+    new_st = %ESME{ st | module_state: new_module_state }
+    {:noreply, new_st}
   end
 
   # Private functions

    do_handle_send_pdu_result(pdu, send_pdu_result, st)
  end

  def handle_cast({:send_pdu, pdu}, st) do
    new_st = do_send_pdu(pdu, st)
    {:noreply, new_st}


  def handle_send_pdu_result(esme, pdu, send_pdu_result) do
    GenServer.call(esme, {:handle_send_pdu_result, pdu, send_pdu_result})
  end

  def call(esme, request, timeout \\ @default_call_timeout) do
    GenServer.call(esme, {:call, request}, timeout)
  end

  def cast(esme, request) do
    GenServer.cast(esme, {:cast, request})
  end

  def info(esme, request) do
    Kernel.send esme, {:info, request}
  end

  # GenServer callbacks
