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 NewModelControllerClient 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 ( ) { } public synchronized void unregister ( ) { } public synchronized FileRepository getRemoteFileRepository ( ) { } @ Override public ModelNode execute ( ModelNode operation ) throws IOException { } @ Override public ModelNode execute ( NewOperation operation ) throws IOException { } @ Override public ModelNode execute ( ModelNode operation , OperationMessageHandler messageHandler ) throws IOException { } @ Override public ModelNode execute ( NewOperation operation , OperationMessageHandler messageHandler ) throws IOException { } @ Override public AsyncFuture < ModelNode > executeAsync ( ModelNode operation , OperationMessageHandler messageHandler ) { } @ Override public AsyncFuture < ModelNode > executeAsync ( NewOperation 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 ) { shutdown . set ( true ) ; if ( ( channelClient ) != null ) { <START_BUG> channelClient . close ( ) ; <END_BUG> } } @ 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 ) { } @ Override public final File [ ] getDeploymentFiles ( byte [ ] deploymentHash ) { } @ Override public File getDeploymentRoot ( byte [ ] deploymentHash ) { } private File getFile ( final String relativePath , final byte repoId ) { } private void setRemoteFileRepositoryExecutor ( NewRemoteDomainConnectionService . RemoteFileRepositoryExecutor remoteFileRepositoryExecutor ) { } } private static interface RemoteFileRepositoryExecutor { File getFile ( final String relativePath , final byte repoId , FileRepository localFileRepository ) { } } private NewRemoteDomainConnectionService . RemoteFileRepositoryExecutor remoteFileRepositoryExecutor = new NewRemoteDomainConnectionService . RemoteFileRepositoryExecutor ( ) { public File getFile ( final String relativePath , final byte repoId , FileRepository localFileRepository ) { } } ; private class FutureClient extends AsyncFutureTask < NewMasterDomainControllerClient > { protected FutureClient ( ) { } private void setClient ( NewMasterDomainControllerClient client ) { } } }

Fix:
unregister ( ) ;