Buggy code:
public class ManagementCommunicationService implements Service < ManagementCommunicationService > { public static final ServiceName SERVICE_NAME = JBOSS . append ( "server" , "manager" , "management" , "communication" ) ; private static final Logger log = Logger . getLogger ( "org.jboss.as.domain.controller" ) ; private final InjectedValue < NetworkInterfaceBinding > interfaceBindingValue = new InjectedValue < NetworkInterfaceBinding > ( ) ; private final InjectedValue < Integer > portValue = new InjectedValue < Integer > ( ) ; private final InjectedValue < ExecutorService > executorServiceValue = new InjectedValue < ExecutorService > ( ) ; private final ConcurrentMap < Byte , ManagementOperationHandler > handlers = new ConcurrentHashMap < Byte , ManagementOperationHandler > ( ) ; private SocketListener socketListener ; public synchronized void start ( StartContext context ) throws StartException { } public synchronized void stop ( StopContext context ) { } public ManagementCommunicationService getValue ( ) throws IllegalStateException { } public Injector < NetworkInterfaceBinding > getInterfaceInjector ( ) { } public Injector < ExecutorService > getExecutorServiceInjector ( ) { } public Injector < Integer > getPortInjector ( ) { } void addHandler ( ManagementOperationHandler handler ) { } void removeHandler ( ManagementOperationHandler handler ) { } private class DomainControllerSocketHandler implements SocketHandler { private final ExecutorService executorService ; private DomainControllerSocketHandler ( final ExecutorService executorService ) { } @ Override public void initializeConnection ( final Socket socket ) throws IOException , InitialSocketRequestException { } } private class RequestTask implements Runnable { private final SocketConnection socketConnection ; private RequestTask ( final SocketConnection socketConnection ) { } public void run ( ) { final InputStream socketIn = socketConnection . getInputStream ( ) ; final OutputStream socketOut = socketConnection . getOutputStream ( ) ; try { final SimpleDataInput input = new SimpleDataInput ( Marshalling . createByteInput ( socketIn ) ) ; final SimpleDataOutput output = new SimpleDataOutput ( Marshalling . createByteOutput ( socketOut ) ) ; final ManagementRequestProtocolHeader requestHeader = new ManagementRequestProtocolHeader ( input ) ; int workingVersion = Math . min ( VERSION , requestHeader . getVersion ( ) ) ; <START_BUG> final ManagementResponseProtocolHeader responseHeader = new ManagementResponseProtocolHeader ( workingVersion ) ; <END_BUG> responseHeader . write ( output ) ; output . flush ( ) ; byte handlerId = requestHeader . getOperationHandlerId ( ) ; if ( handlerId == ( - 1 ) ) { throw new ManagementOperationException ( "Management<seq2seq4repair_space>request<seq2seq4repair_space>failed.<seq2seq4repair_space>Invalid<seq2seq4repair_space>handler<seq2seq4repair_space>id" ) ; } final ManagementOperationHandler handler = handlers . get ( handlerId ) ; if ( handler == null ) { throw new ManagementOperationException ( ( "Management<seq2seq4repair_space>request<seq2seq4repair_space>failed.<seq2seq4repair_space>NO<seq2seq4repair_space>handler<seq2seq4repair_space>found<seq2seq4repair_space>for<seq2seq4repair_space>id" + handlerId ) ) ; } handler . handleRequest ( workingVersion , input , output ) ; } catch ( Exception e ) { ManagementCommunicationService . log . error ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>process<seq2seq4repair_space>management<seq2seq4repair_space>request" , e ) ; } finally { socketConnection . close ( ) ; } } } }

Fix:
final ManagementResponseProtocolHeader responseHeader = new ManagementResponseProtocolHeader ( workingVersion , requestHeader . getRequestId ( ) ) ;