Buggy code:
public class WebSocketEmulatedHandler extends WebSocketHandlerAdapter { static final String CLASS_NAME = WebSocketEmulatedHandler . class . getName ( ) ; static final Logger LOG = Logger . getLogger ( WebSocketEmulatedHandler . CLASS_NAME ) ; static final String HEADER_CONTENT_TYPE = "Content-Type" ; static final String HEADER_COOKIE = "Cookie" ; static final String HEADER_SET_COOKIE = "Set-Cookie" ; static final Charset UTF_8 = Charset . forName ( "UTF-8" ) ; static CreateHandlerFactory createHandlerFactory = CreateHandlerImpl . FACTORY ; static DownstreamHandlerFactory downstreamHandlerFactory = DownstreamHandlerImpl . FACTORY ; static UpstreamHandlerFactory upstreamHandlerFactory = UpstreamHandlerImpl . FACTORY ; private final CreateHandler createHandler = WebSocketEmulatedHandler . createHandlerFactory . createCreateHandler ( ) ; private final UpstreamHandler upstreamHandler = WebSocketEmulatedHandler . upstreamHandlerFactory . createUpstreamHandler ( ) ; private final DownstreamHandler downstreamHandler = WebSocketEmulatedHandler . downstreamHandlerFactory . createDownstreamHandler ( ) ; public WebSocketEmulatedHandler ( ) { } void initCreateHandler ( CreateHandler handler ) { } void initUpstreamHandler ( UpstreamHandler handler ) { } void initDownstreamHandler ( DownstreamHandler handler ) { handler . setListener ( new DownstreamHandlerListener ( ) { @ Override public void downstreamOpened ( DownstreamChannel channel ) { } @ Override public void binaryMessageReceived ( DownstreamChannel channel , WrappedByteBuffer data ) { WebSocketEmulatedChannel wsebChannel = ( ( WebSocketEmulatedChannel ) ( channel . getParent ( ) ) ) ; listener . binaryMessageReceived ( wsebChannel , data ) ; } @ Override public void textMessageReceived ( DownstreamChannel channel , String text ) { WebSocketEmulatedChannel wsebChannel = ( ( WebSocketEmulatedChannel ) ( channel . getParent ( ) ) ) ; listener . textMessageReceived ( wsebChannel , text ) ; } @ Override public void downstreamFailed ( DownstreamChannel channel , Exception exception ) { WebSocketEmulatedChannel wsebChannel = ( ( WebSocketEmulatedChannel ) ( channel . getParent ( ) ) ) ; <START_BUG> listener . connectionFailed ( wsebChannel , exception ) ; <END_BUG> } @ Override public void downstreamClosed ( DownstreamChannel channel ) { WebSocketEmulatedChannel wsebChannel = ( ( WebSocketEmulatedChannel ) ( channel . getParent ( ) ) ) ; doClose ( wsebChannel ) ; } @ Override public void commandMessageReceived ( DownstreamChannel channel , CommandMessage message ) { WebSocketEmulatedChannel wsebChannel = ( ( WebSocketEmulatedChannel ) ( channel . getParent ( ) ) ) ; if ( message instanceof CloseCommandMessage ) { CloseCommandMessage msg = ( ( CloseCommandMessage ) ( message ) ) ; wsebChannel . wasCleanClose = true ; wsebChannel . closeCode = msg . getCode ( ) ; wsebChannel . closeReason = msg . getReason ( ) ; if ( ( wsebChannel . getReadyState ( ) ) == ( ReadyState . OPEN ) ) { upstreamHandler . processClose ( wsebChannel . upstreamChannel , msg . getCode ( ) , msg . getReason ( ) ) ; } } listener . commandMessageReceived ( wsebChannel , message ) ; } @ Override public void pingReceived ( DownstreamChannel channel ) { WebSocketEmulatedChannel wsebChannel = ( ( WebSocketEmulatedChannel ) ( channel . getParent ( ) ) ) ; upstreamHandler . processPong ( wsebChannel . upstreamChannel ) ; } } ) ; } @ Override public synchronized void processConnect ( WebSocketChannel channel , WSURI location , String [ ] protocols ) { } @ Override public synchronized void processClose ( WebSocketChannel channel , int code , String reason ) { } @ Override public void processTextMessage ( WebSocketChannel channel , String message ) { } @ Override public void processBinaryMessage ( WebSocketChannel channel , WrappedByteBuffer message ) { } private void doError ( WebSocketEmulatedChannel channel , Exception exception ) { } private void doClose ( WebSocketEmulatedChannel channel ) { } }

Fix:
doError ( wsebChannel , exception ) ;