Buggy code:
public class VersionOneProtocolChannelReceiver implements DeploymentRepositoryListener , Channel . Receiver { private static final Logger logger = Logger . getLogger ( VersionOneProtocolChannelReceiver . class ) ; private static final byte HEADER_SESSION_OPEN_REQUEST = 1 ; private static final byte HEADER_INVOCATION_REQUEST = 3 ; private final ServiceContainer serviceContainer ; private final Channel channel ; private final DeploymentRepository deploymentRepository ; private final String marshallingStrategy ; private final ExecutorService executorService ; public VersionOneProtocolChannelReceiver ( final Channel channel , final ServiceContainer serviceContainer , final String marshallingStrategy , final ExecutorService executorService ) { } public void startReceiving ( ) { } @ Override public void handleError ( Channel channel , IOException error ) { } @ Override public void handleEnd ( Channel channel ) { } @ Override public void handleMessage ( Channel channel , MessageInputStream messageInputStream ) { try { final int header = messageInputStream . read ( ) ; if ( VersionOneProtocolChannelReceiver . logger . isTraceEnabled ( ) ) { VersionOneProtocolChannelReceiver . logger . trace ( ( ( ( "Got<seq2seq4repair_space>message<seq2seq4repair_space>with<seq2seq4repair_space>header<seq2seq4repair_space>0x" + ( Integer . toHexString ( header ) ) ) + "<seq2seq4repair_space>on<seq2seq4repair_space>channel<seq2seq4repair_space>" ) + channel ) ) ; } MessageHandler messageHandler = null ; switch ( header ) { case VersionOneProtocolChannelReceiver . HEADER_INVOCATION_REQUEST : messageHandler = new MethodInvocationMessageHandler ( this . deploymentRepository , this . marshallingStrategy , this . executorService ) ; messageHandler . processMessage ( channel , messageInputStream ) ; break ; case VersionOneProtocolChannelReceiver . HEADER_SESSION_OPEN_REQUEST : <START_BUG> messageHandler = new SessionOpenRequestHandler ( this . deploymentRepository , this . marshallingStrategy ) ; <END_BUG> messageHandler . processMessage ( channel , messageInputStream ) ; break ; default : VersionOneProtocolChannelReceiver . logger . warn ( ( ( ( "Received<seq2seq4repair_space>unsupported<seq2seq4repair_space>message<seq2seq4repair_space>header<seq2seq4repair_space>0x" + ( Integer . toHexString ( header ) ) ) + "<seq2seq4repair_space>on<seq2seq4repair_space>channel<seq2seq4repair_space>" ) + channel ) ) ; } channel . receiveMessage ( this ) ; } catch ( IOException e ) { VersionOneProtocolChannelReceiver . logger . errorf ( e , "Exception<seq2seq4repair_space>on<seq2seq4repair_space>channel<seq2seq4repair_space>%s<seq2seq4repair_space>from<seq2seq4repair_space>message<seq2seq4repair_space>%s" , channel , messageInputStream ) ; try { channel . close ( ) ; } catch ( IOException e1 ) { } } finally { IoUtils . safeClose ( messageInputStream ) ; } } @ Override public void listenerAdded ( DeploymentRepository repository ) { } @ Override public void deploymentAvailable ( DeploymentModuleIdentifier deploymentModuleIdentifier , ModuleDeployment moduleDeployment ) { } @ Override public void deploymentRemoved ( DeploymentModuleIdentifier deploymentModuleIdentifier ) { } private DeploymentRepository getDeploymentRepository ( ) { } private void sendModuleAvailability ( DeploymentModuleIdentifier [ ] availableModules ) throws IOException { } private void sendModuleUnAvailability ( DeploymentModuleIdentifier [ ] availableModules ) throws IOException { } private class ChannelCloseHandler implements CloseHandler < Channel > { @ Override public void handleClose ( Channel closedChannel , IOException exception ) { } } }

Fix:
messageHandler = new SessionOpenRequestHandler ( this . deploymentRepository , this . marshallingStrategy , this . executorService ) ;