Buggy code:
public class AS2SenderModule extends AbstractHttpSenderModule { private static final String ATTR_PENDINGMDNINFO = "pendingmdninfo" ; private static final String ATTR_PENDINGMDN = "pendingmdn" ; private static final Logger s_aLogger = LoggerFactory . getLogger ( AS2SenderModule . class ) ; public AS2SenderModule ( ) { } public boolean canHandle ( @ Nonnull final String sAction , @ Nonnull final IMessage aMsg , @ Nullable final Map < String , Object > aOptions ) { } protected void checkRequired ( @ Nonnull final AS2Message aMsg ) throws InvalidParameterException { } protected void storePendingInfo ( @ Nonnull final AS2Message aMsg , @ Nonnull final String sMIC ) throws OpenAS2Exception { } @ Nonnull @ Nonempty protected String calculateAndStoreMIC ( @ Nonnull final AS2Message aMsg ) throws Exception { } @ Nonnull protected MimeBodyPart compress ( @ Nonnull final IMessage aMsg , @ Nonnull final MimeBodyPart aData , @ Nonnull final ECompressionType eCompressionType ) throws MessagingException , SMIMEException { } @ Nonnull protected MimeBodyPart secure ( @ Nonnull final IMessage aMsg ) throws Exception { } protected void updateHttpHeaders ( @ Nonnull final IAS2HttpHeaderWrapper aConn , @ Nonnull final IMessage aMsg ) { } protected void receiveSyncMDN ( @ Nonnull final AS2Message aMsg , @ Nonnull final HttpURLConnection aConn , @ Nonnull final String sOriginalMIC ) throws OpenAS2Exception , IOException { } @ OverrideOnDemand protected void onReceivedMDNError ( @ Nonnull final AS2Message aMsg , @ Nonnull final OpenAS2Exception ex ) { } private void _sendViaHTTP ( @ Nonnull final AS2Message aMsg , @ Nonnull final MimeBodyPart aSecuredData , @ Nonnull final String sMIC ) throws OpenAS2Exception , IOException , MessagingException { } public void handle ( @ Nonnull final String sAction , @ Nonnull final IMessage aBaseMsg , @ Nullable final Map < String , Object > aOptions ) throws OpenAS2Exception { final AS2Message aMsg = ( ( AS2Message ) ( aBaseMsg ) ) ; AS2SenderModule . s_aLogger . info ( ( "Submitting<seq2seq4repair_space>message" + ( aMsg . getLoggingText ( ) ) ) ) ; checkRequired ( aMsg ) ; <START_BUG> final int nRetries = getRetryCount ( aOptions ) ; <END_BUG> try { final MimeBodyPart aSecuredData = secure ( aMsg ) ; final String sMIC = calculateAndStoreMIC ( aMsg ) ; if ( AS2SenderModule . s_aLogger . isDebugEnabled ( ) ) AS2SenderModule . s_aLogger . debug ( ( ( "Setting<seq2seq4repair_space>message<seq2seq4repair_space>content<seq2seq4repair_space>type<seq2seq4repair_space>to<seq2seq4repair_space>'" + ( aSecuredData . getContentType ( ) ) ) + "'" ) ) ; aMsg . setContentType ( aSecuredData . getContentType ( ) ) ; _sendViaHTTP ( aMsg , aSecuredData , sMIC ) ; } catch ( final HttpResponseException ex ) { AS2SenderModule . s_aLogger . error ( ( "Http<seq2seq4repair_space>Response<seq2seq4repair_space>Error<seq2seq4repair_space>" + ( ex . getMessage ( ) ) ) ) ; ex . terminate ( ) ; if ( ! ( doResend ( DO_SEND , aMsg , ex , nRetries ) ) ) throw ex ; } catch ( final IOException ex ) { final OpenAS2Exception wioe = WrappedOpenAS2Exception . wrap ( ex ) ; wioe . addSource ( SOURCE_MESSAGE , aMsg ) ; wioe . terminate ( ) ; if ( ! ( doResend ( DO_SEND , aMsg , wioe , nRetries ) ) ) throw wioe ; } catch ( final Exception ex ) { throw WrappedOpenAS2Exception . wrap ( ex ) ; } } }

Fix:
final int nRetries = getRetryCount ( aMsg . getPartnership ( ) , aOptions ) ;