Buggy code:
public final class SLPDaemonImpl implements SLPDaemon { private boolean running = true ; private Map registeredServices = new HashMap ( ) ; private SortedMap serviceDisposalQueue = new TreeMap ( ) ; public SLPDaemonImpl ( ) throws Exception { } private void registerService ( final ServiceRegistration reg ) { } private void deregisterService ( final ServiceDeregistration dereg ) throws ServiceLocationException { } public ReplyMessage handleMessage ( final SLPMessage msg ) throws ServiceLocationException { } public void newDaDiscovered ( final DAAdvertisement advert ) { } private void announceService ( final String dAAddress , final ServiceRegistration reg ) throws ServiceLocationException { } private final class TcpServerThread extends Thread { private ServerSocket socket ; private TcpServerThread ( ) throws IOException { } public void run ( ) { while ( running ) { try { Socket con = socket . accept ( ) ; DataInputStream in = new DataInputStream ( new BufferedInputStream ( con . getInputStream ( ) ) ) ; SLPMessage msg = SLPMessage . parse ( con . getInetAddress ( ) , con . getPort ( ) , in , true ) ; ReplyMessage reply = handleMessage ( msg ) ; if ( reply != null ) { platform . logTraceMessage ( ( ( ( ( ( "SEND<seq2seq4repair_space>REPLY<seq2seq4repair_space>(" + ( reply . address ) ) + ":" ) + ( reply . port ) ) + ")<seq2seq4repair_space>" ) + reply ) ) ; DataOutputStream out = new DataOutputStream ( con . getOutputStream ( ) ) ; <START_BUG> reply . writeTo ( out ) ; <END_BUG> out . close ( ) ; } in . close ( ) ; con . close ( ) ; } catch ( Exception ioe ) { platform . logError ( "Exception<seq2seq4repair_space>in<seq2seq4repair_space>TCP<seq2seq4repair_space>receiver<seq2seq4repair_space>thread" , ioe ) ; } } } } private final class ServiceDisposalThread extends Thread { private ServiceDisposalThread ( ) { } public void run ( ) { try { while ( running ) { synchronized ( serviceDisposalQueue ) { if ( serviceDisposalQueue . isEmpty ( ) ) { platform . logDebug ( "ServiceDisposalThread<seq2seq4repair_space>sleeping<seq2seq4repair_space>..." ) ; serviceDisposalQueue . wait ( ) ; } else { Long nextActivity ; while ( ( ! ( serviceDisposalQueue . isEmpty ( ) ) ) && ( ( ( nextActivity = ( ( Long ) ( serviceDisposalQueue . firstKey ( ) ) ) ) . longValue ( ) ) <= ( System . currentTimeMillis ( ) ) ) ) { ServiceURL service = ( ( ServiceURL ) ( serviceDisposalQueue . get ( nextActivity ) ) ) ; ServiceDeregistration dereg = new ServiceDeregistration ( service , null , null , SLPCore . DEFAULT_LOCALE ) ; try { deregisterService ( dereg ) ; } catch ( ServiceLocationException sle ) { platform . logError ( sle . getMessage ( ) , sle . fillInStackTrace ( ) ) ; } platform . logTraceReg ( ( "disposed<seq2seq4repair_space>service<seq2seq4repair_space>" + service ) ) ; serviceDisposalQueue . remove ( nextActivity ) ; } if ( ! ( serviceDisposalQueue . isEmpty ( ) ) ) { nextActivity = ( ( Long ) ( serviceDisposalQueue . firstKey ( ) ) ) ; long waitTime = ( nextActivity . longValue ( ) ) - ( System . currentTimeMillis ( ) ) ; if ( waitTime > 0 ) { platform . logDebug ( ( ( "sleeping<seq2seq4repair_space>for<seq2seq4repair_space>" + ( waitTime // 1000 ) ) + "<seq2seq4repair_space>seconds." ) ) ; serviceDisposalQueue . wait ( waitTime ) ; } } } } } } catch ( InterruptedException ie ) { } } } }

Fix:
out . write ( reply . getBytes ( ) ) ;