Buggy code:
public class NewRemoteDomainConnectionService implements NewMasterDomainControllerClient , ClosedCallback , Service < NewMasterDomainControllerClient > { private static final Logger log = Logger . getLogger ( "org.jboss.as.domain.controller" ) ; private final NewModelController controller ; private final InetAddress host ; private final int port ; private final String name ; private final NewRemoteDomainConnectionService . RemoteFileRepository remoteFileRepository ; private volatile ProtocolChannelClient < ManagementChannel > channelClient ; private volatile ModelControllerClient masterProxy ; private volatile NewTransactionalModelControllerOperationHandler 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 NewRemoteDomainConnectionService . FutureClient futureClient = new NewRemoteDomainConnectionService . FutureClient ( ) ; private final InjectedValue < Endpoint > endpointInjector = new InjectedValue < Endpoint > ( ) ; private NewRemoteDomainConnectionService ( final NewModelController controller , final String name , final InetAddress host , final int port , final NewRemoteDomainConnectionService . RemoteFileRepository remoteFileRepository ) { } public static Future < NewMasterDomainControllerClient > install ( final ServiceTarget serviceTarget , final NewModelController controller , final String localHostName , final String remoteDcHost , final int remoteDcPort , final NewRemoteDomainConnectionService . RemoteFileRepository remoteFileRepository ) { } public void register ( ) { } private synchronized void connect ( ) { txOperationHandler = new NewTransactionalModelControllerOperationHandler ( 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 { <START_BUG> client . connect ( ) ; <END_BUG> this . channelClient = client ; if ( connected . get ( ) ) { unregister ( ) ; } ManagementChannel channel = client . openChannel ( DOMAIN_CHANNEL ) ; this . channel = channel ; channel . addCloseHandler ( new org . jboss . remoting3 . CloseHandler < Channel > ( ) { public void handleClose ( Channel closed ) { connectionClosed ( ) ; } } ) ; channel . startReceiving ( ) ; masterProxy = new org . jboss . as . controller . remote . ExistingChannelModelControllerClient ( channel ) ; } catch ( IOException e ) { NewRemoteDomainConnectionService . 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 NewRemoteDomainConnectionService . RegisterModelControllerRequest ( ) . executeForResult ( executor , ManagementClientChannelStrategy . create ( channel ) ) ; if ( error != null ) { throw new Exception ( error ) ; } } catch ( Exception e ) { NewRemoteDomainConnectionService . 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 NewMasterDomainControllerClient getValue ( ) throws IllegalArgumentException , IllegalStateException { } private abstract class RegistryRequest < T > extends ManagementRequest < T > { protected T readResponse ( DataInput input ) throws IOException { } } private class RegisterModelControllerRequest extends NewRemoteDomainConnectionService . RegistryRequest < String > { RegisterModelControllerRequest ( ) { } @ Override protected byte getRequestCode ( ) { } @ Override protected void writeRequest ( final int protocolVersion , final FlushableDataOutput output ) throws IOException { } @ Override protected String readResponse ( DataInput input ) throws IOException { } } private class UnregisterModelControllerRequest extends NewRemoteDomainConnectionService . RegistryRequest < Void > { @ Override protected byte getRequestCode ( ) { } @ Override protected void writeRequest ( final int protocolVersion , final FlushableDataOutput output ) throws IOException { } } private class GetFileRequest extends NewRemoteDomainConnectionService . 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 { } @ Override protected final File readResponse ( final DataInput input ) throws IOException { } } static class RemoteFileRepository implements FileRepository { private final FileRepository localFileRepository ; private volatile NewRemoteDomainConnectionService . RemoteFileRepositoryExecutor remoteFileRepositoryExecutor ; RemoteFileRepository ( final FileRepository localFileRepository ) { } @ Override public final File getFile ( String relativePath ) { } @ Override public final File getConfigurationFile ( String relativePath ) { }

Fix:
client . connect ( null ) ;