added resending logic if send attempt failed
added unittest for resend logic testing