Buggy code:
public class RemoteDomainConnectionService implements MasterDomainControllerClient , ClosedCallback , Service < MasterDomainControllerClient > { private static final Logger log = Logger . getLogger ( "org.jboss.as.domain.controller" ) ; private final ModelController controller ; private final InetAddress host ; private final int port ; private final String name ; private final RemoteDomainConnectionService . RemoteFileRepository remoteFileRepository ; private final Provider saslProvider = new JBossSaslProvider ( ) ; private volatile ProtocolChannelClient < ManagementChannel > channelClient ; private volatile ModelControllerClient masterProxy ; private volatile TransactionalModelControllerOperationHandler txOperationHandler ; private final AtomicBoolean shutdown = new AtomicBoolean ( ) ; private volatile ManagementChannel channel ; private final ExecutorService executor = Executors . newCachedThreadPool ( ) ; private final AtomicBoolean connected = new AtomicBoolean ( false ) ; private final RemoteDomainConnectionService . FutureClient futureClient = new RemoteDomainConnectionService . FutureClient ( ) ; private final InjectedValue < Endpoint > endpointInjector = new InjectedValue < Endpoint > ( ) ; private final InjectedValue < CallbackHandlerFactory > callbackFactoryInjector = new InjectedValue < CallbackHandlerFactory > ( ) ; private RemoteDomainConnectionService ( final ModelController controller , final String name , final InetAddress host , final int port , final RemoteDomainConnectionService . RemoteFileRepository remoteFileRepository ) { } public static Future < MasterDomainControllerClient > install ( final ServiceTarget serviceTarget , final ModelController controller , final String localHostName , final String remoteDcHost , final int remoteDcPort , final String securityRealm , final RemoteDomainConnectionService . RemoteFileRepository remoteFileRepository ) { } public void register ( ) { } private synchronized void connect ( ) { Security . addProvider ( saslProvider ) ; txOperationHandler = new TransactionalModelControllerOperationHandler ( executor , controller ) ; ProtocolChannelClient < ManagementChannel > client ; try { ProtocolChannelClient . Configuration < ManagementChannel > configuration = new ProtocolChannelClient . Configuration < ManagementChannel > ( ) ; configuration . setEndpoint ( endpointInjector . getValue ( ) ) ; configuration . setUri ( new URI ( ( ( ( "remote:////" + ( host . getHostAddress ( ) ) ) + ":" ) + ( port ) ) ) ) ; configuration . setChannelFactory ( new org . jboss . as . protocol . mgmt . ManagementChannelFactory ( txOperationHandler ) ) ; client = ProtocolChannelClient . create ( configuration ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } try { CallbackHandler handler = null ; CallbackHandlerFactory handlerFactory = callbackFactoryInjector . getOptionalValue ( ) ; if ( handlerFactory != null ) { handler = handlerFactory . getCallbackHandler ( name ) ; } client . connect ( handler ) ; this . channelClient = client ; if ( connected . get ( ) ) { unregister ( ) ; } ManagementChannel channel = client . openChannel ( DOMAIN_CHANNEL ) ; this . channel = channel ; channel . addCloseHandler ( new org . jboss . remoting3 . CloseHandler < Channel > ( ) { <START_BUG> public void handleClose ( Channel closed ) { <END_BUG> connectionClosed ( ) ; } } ) ; channel . startReceiving ( ) ; masterProxy = new org . jboss . as . controller . remote . ExistingChannelModelControllerClient ( channel ) ; } catch ( IOException e ) { RemoteDomainConnectionService . log . warnf ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>connect<seq2seq4repair_space>to<seq2seq4repair_space>remote<seq2seq4repair_space>domain<seq2seq4repair_space>controller<seq2seq4repair_space>%s:%d" , host . getHostAddress ( ) , port ) ; e . printStackTrace ( ) ; throw new IllegalStateException ( e ) ; } try { final String error = new RemoteDomainConnectionService . RegisterModelControllerRequest ( ) . executeForResult ( executor , ManagementClientChannelStrategy . create ( channel ) ) ; if ( error != null ) { throw new Exception ( error ) ; } } catch ( Exception e ) { RemoteDomainConnectionService . log . warnf ( "Error<seq2seq4repair_space>retrieving<seq2seq4repair_space>domain<seq2seq4repair_space>model<seq2seq4repair_space>from<seq2seq4repair_space>remote<seq2seq4repair_space>domain<seq2seq4repair_space>controller<seq2seq4repair_space>%s:%d:<seq2seq4repair_space>%s" , host . getHostAddress ( ) , port , e . getMessage ( ) ) ; throw new IllegalStateException ( e ) ; } } public synchronized void unregister ( ) { } public synchronized FileRepository getRemoteFileRepository ( ) { } @ Override public ModelNode execute ( ModelNode operation ) throws IOException { } @ Override public ModelNode execute ( Operation operation ) throws IOException { } @ Override public ModelNode execute ( ModelNode operation , OperationMessageHandler messageHandler ) throws IOException { } @ Override public ModelNode execute ( Operation operation , OperationMessageHandler messageHandler ) throws IOException { } @ Override public AsyncFuture < ModelNode > executeAsync ( ModelNode operation , OperationMessageHandler messageHandler ) { } @ Override public AsyncFuture < ModelNode > executeAsync ( Operation operation , OperationMessageHandler messageHandler ) { } @ Override public void close ( ) throws IOException { } @ Override public synchronized void start ( StartContext context ) throws StartException { } @ Override public synchronized void stop ( StopContext context ) { } @ Override public void connectionClosed ( ) { } @ Override public synchronized MasterDomainControllerClient getValue ( ) throws IllegalArgumentException , IllegalStateException { } private abstract class RegistryRequest < T > extends ManagementRequest < T > { } private class RegisterModelControllerRequest extends RemoteDomainConnectionService . RegistryRequest < String > { RegisterModelControllerRequest ( ) { } @ Override protected byte getRequestCode ( ) { } @ Override protected void writeRequest ( final int protocolVersion , final FlushableDataOutput output ) throws IOException { } protected ManagementResponseHandler < String > getResponseHandler ( ) { } } private class UnregisterModelControllerRequest extends RemoteDomainConnectionService . RegistryRequest < Void > { @ Override protected byte getRequestCode ( ) { } @ Override protected void writeRequest ( final int protocolVersion , final FlushableDataOutput output ) throws IOException { } protected ManagementResponseHandler < Void > getResponseHandler ( ) { } } private class GetFileRequest extends RemoteDomainConnectionService . RegistryRequest < File > { private final byte rootId ; private final String filePath ; private final FileRepository localFileRepository ; private GetFileRequest ( final byte rootId , final String filePath , final FileRepository localFileRepository ) { } @ Override public final byte getRequestCode ( ) { } @ Override protected final void writeRequest ( final int protocolVersion , final FlushableDataOutput output ) throws IOException { } protected ManagementResponseHandler < File > getResponseHandler ( ) { } }

Fix:
public void handleClose ( final Channel closed , final IOException exception ) {