Buggy code:
public class AeronStaticTransportAdapter implements ConnectionlessTransportAdapter { private static final boolean PROXY_CREATION_AT_STARTUP = AeronAdapterConfiguration . PROXY_CREATION_AT_STARTUP ; private static final int FRAGMENT_COUNT_LIMIT = AeronAdapterConfiguration . FRAGMENT_COUNT_LIMIT ; private static final boolean DISABLE_EMBEDDED_MEDIA_DRIVER = AeronAdapterConfiguration . DISABLE_EMBEDDED_MEDIA_DRIVER ; private final ThreadLocal < AeronMessage > tlAeronMessage = new ThreadLocal < AeronMessage > ( ) { @ Override protected AeronMessage initialValue ( ) { } } ; protected MediaDriver driver ; private String uniqueAeronDir ; protected AeronStaticTransportAdapter . AeronWrapper aeronWrapper ; protected final AeronLogicalNameMapping logicalNameMapping = new AeronLogicalNameMapping ( ) ; protected final Map < AeronPhysicalStream , Publication > proxyPublicationMap = new HashMap < > ( ) ; protected final Map < AeronPhysicalStream , Subscription > proxySubscriptionsMap = new HashMap < > ( ) ; final ExecutorService executor = Executors . newFixedThreadPool ( 1 ) ; private final AtomicBoolean running = new AtomicBoolean ( true ) ; private final IdleStrategy idleStrategy = new BackoffIdleStrategy ( 100 , 10 , TimeUnit . MICROSECONDS . toNanos ( 1 ) , TimeUnit . MICROSECONDS . toNanos ( 100 ) ) ; private final CopyOnWriteArrayList < BiConsumer < String , CanonicalMessage > > messageListeners = new CopyOnWriteArrayList < > ( ) ; protected Properties loadPropertiesFromFile ( String fileName ) throws IOException { } protected void loadStaticProxyPublicationsAndSubscriptions ( ) throws IOException { } @ Override public void start ( ) { } @ Override public void stop ( ) { } protected void addProxyPublication ( String logicalName , AeronPhysicalStream physicalStream ) { } protected void addProxySubscription ( String logicalName , AeronPhysicalStream physicalStream ) { } public void pollSubscribers ( ) { } public Publication deleteProxyPublication ( AeronPhysicalStream physicalStream ) { } public Subscription deleteProxySubscription ( AeronPhysicalStream physicalStream ) { } @ Override public void onRemoteProducerDetected ( String logicalName , String uniqueId ) { } @ Override public void onRemoteProducerRemoved ( String logicalName , String uniqueId ) { } @ Override public void onRemoteConsumerDetected ( String logicalName , String uniqueId ) { } @ Override public void onRemoteConsumerRemoved ( String logicalName , String uniqueId ) { } @ Override public void onRemoteMessageReceived ( String logicalName , CanonicalMessage canonicalMessage ) { List < AeronPhysicalStream > physicalStreams = logicalNameMapping . getLogicalNameToPublicationsMap ( ) . get ( logicalName ) ; if ( ( physicalStreams != null ) && ( ( physicalStreams . size ( ) ) > 0 ) ) { for ( AeronPhysicalStream physicalStream : physicalStreams ) { Publication publication = proxyPublicationMap . get ( physicalStream ) ; if ( publication != null ) { <START_BUG> boolean result = publication . offer ( canonicalMessage . getBuffer ( ) , canonicalMessage . getOffset ( ) , canonicalMessage . getLength ( ) ) ; <END_BUG> } } } else { } } @ Override public void onLocalProducerDetected ( String logicalName , String uniqueId ) { } @ Override public void onLocalProducerRemoved ( String logicalName , String uniqueId ) { } @ Override public void onLocalConsumerDetected ( String logicalName , String uniqueId ) { } @ Override public void onLocalConsumerRemoved ( String logicalName , String uniqueId ) { } @ Override public void addLocalMessageReceivedListener ( BiConsumer < String , CanonicalMessage > messageHandler ) { } @ Override public void removeLocalMessageReceivedListener ( BiConsumer < String , CanonicalMessage > messageHandler ) { } @ Override public void onLocalMessageReceived ( String logicalName , CanonicalMessage message ) { } class AeronWrapper { private final Aeron aeron ; public AeronWrapper ( Aeron aeron ) { } public Subscription addSubscription ( String channel , int streamId , DataHandler dataHandler ) { } public Publication addPublication ( String channel , int streamId ) { } public void close ( ) { } } }

Fix:
long result = publication . offer ( canonicalMessage . getBuffer ( ) , canonicalMessage . getOffset ( ) , canonicalMessage . getLength ( ) ) ;