Buggy code:
public class Mina2Producer extends DefaultProducer implements ServicePoolAware { private static final Logger LOG = LoggerFactory . getLogger ( Mina2Producer . class ) ; private IoSession session ; private CountDownLatch latch ; private boolean lazySessionCreation ; private long timeout ; private SocketAddress address ; private IoConnector connector ; private boolean sync ; private CamelLogger noReplyLogger ; private Mina2Configuration configuration ; private IoSessionConfig connectorConfig ; private ExecutorService workerPool ; public Mina2Producer ( Mina2Endpoint endpoint ) throws Exception { } @ Override public Mina2Endpoint getEndpoint ( ) { } @ Override public boolean isSingleton ( ) { } public void process ( Exchange exchange ) throws Exception { } @ SuppressWarnings ( "deprecation" ) protected void doProcess ( Exchange exchange ) throws Exception { } protected void maybeDisconnectOnDone ( Exchange exchange ) { } public DefaultIoFilterChainBuilder getFilterChain ( ) { } @ Override protected void doStart ( ) throws Exception { } @ Override protected void doStop ( ) throws Exception { } @ Override protected void doShutdown ( ) throws Exception { } private void closeConnection ( ) { } private void openConnection ( ) { } protected void setupVmProtocol ( String uri ) { } protected void setupSocketProtocol ( String uri ) throws Exception { boolean minaLogger = configuration . isMinaLogger ( ) ; long timeout = configuration . getTimeout ( ) ; List < IoFilter > filters = configuration . getFilters ( ) ; address = new InetSocketAddress ( configuration . getHost ( ) , configuration . getPort ( ) ) ; final int processorCount = ( Runtime . getRuntime ( ) . availableProcessors ( ) ) + 1 ; connector = new NioSocketConnector ( processorCount ) ; connectorConfig = connector . getSessionConfig ( ) ; if ( configuration . isOrderedThreadPoolExecutor ( ) ) { workerPool = new org . apache . mina . filter . executor . OrderedThreadPoolExecutor ( configuration . getMaximumPoolSize ( ) ) ; } else { workerPool = new org . apache . mina . filter . executor . UnorderedThreadPoolExecutor ( configuration . getMaximumPoolSize ( ) ) ; } connector . getFilterChain ( ) . addLast ( "threadPool" , new ExecutorFilter ( workerPool ) ) ; if ( minaLogger ) { connector . getFilterChain ( ) . addLast ( "logger" , new LoggingFilter ( ) ) ; } appendIoFiltersToChain ( filters , connector . getFilterChain ( ) ) ; if ( ( configuration . getSslContextParameters ( ) ) != null ) { SslFilter filter = new SslFilter ( configuration . getSslContextParameters ( ) . createSSLContext ( ) , configuration . isAutoStartTls ( ) ) ; filter . setUseClientMode ( true ) ; <START_BUG> acceptor . getFilterChain ( ) . addFirst ( "sslFilter" , filter ) ; <END_BUG> } configureCodecFactory ( "Mina2Producer" , connector ) ; connector . setConnectTimeoutMillis ( timeout ) ; } protected void configureCodecFactory ( String type , IoService service ) { } protected void configureDefaultCodecFactory ( String type , IoService service ) { } protected void setupDatagramProtocol ( String uri ) { } protected void configureDataGramCodecFactory ( final String type , final IoService service , final Mina2Configuration configuration ) { } private void addCodecFactory ( IoService service , ProtocolCodecFactory codecFactory ) { } private static LineDelimiter getLineDelimiterParameter ( Mina2TextLineDelimiter delimiter ) { } private Charset getEncodingParameter ( String type , Mina2Configuration configuration ) { } private void appendIoFiltersToChain ( List < IoFilter > filters , DefaultIoFilterChainBuilder filterChain ) { } private void setSocketAddress ( String protocol ) { } private final class ResponseHandler extends IoHandlerAdapter { private Object message ; private Throwable cause ; private boolean messageReceived ; public void reset ( ) { } @ Override public void messageReceived ( IoSession ioSession , Object message ) throws Exception { } protected void countDown ( ) { } @ Override public void sessionClosed ( IoSession session ) throws Exception { } @ Override public void exceptionCaught ( IoSession ioSession , Throwable cause ) { } public Throwable getCause ( ) { } public Object getMessage ( ) { } public boolean isMessageReceived ( ) { } } }

Fix:
connector . getFilterChain ( ) . addFirst ( "sslFilter" , filter ) ;