Buggy code:
public class SimpleServer implements Runnable , Server { private final int port ; private final String servername ; private volatile ServerSocket server ; private volatile Thread thread ; private volatile SortedList < ServerListener > listeners = new SortedList < ServerListener > ( new Comparator < ServerListener > ( ) { @ Override public int compare ( ServerListener o1 , ServerListener o2 ) { } } ) ; public SimpleServer ( int port , String servername ) { } public void startServer ( ) throws Exception { } @ SuppressWarnings ( "deprecation" ) public void stopServer ( ) throws IOException { } @ Override public boolean isRunning ( ) { } public void addListener ( ServerListener listener ) { } public void removeListener ( ServerListener listener ) { } private SimpleServerEvent callEvent ( SimpleServerEvent event ) { } @ Override public void run ( ) { while ( true ) { try { Socket socket = server . accept ( ) ; DataOutputStream response = new DataOutputStream ( socket . getOutputStream ( ) ) ; BufferedReader read = new BufferedReader ( new InputStreamReader ( socket . getInputStream ( ) ) ) ; String line = "" ; String [ ] headerdata = new String [ 5 ] ; int postindex = - 1 ; while ( ( ( line = read . readLine ( ) ) != null ) && ( ( line . length ( ) ) != 0 ) ) { if ( line . startsWith ( "GET" ) ) { headerdata [ 0 ] = new String ( line ) ; } else if ( line . startsWith ( "POST" ) ) { headerdata [ 0 ] = new String ( line ) ; } else if ( line . startsWith ( "Host:" ) ) { headerdata [ 1 ] = new String ( line ) ; } else if ( line . startsWith ( "User-Agent:" ) ) { headerdata [ 2 ] = new String ( line ) ; } else if ( line . startsWith ( "Accept-Language:" ) ) { headerdata [ 3 ] = new String ( line ) ; } else if ( ( line . indexOf ( "Content-Length:" ) ) > ( - 1 ) ) { postindex = new Integer ( line . substring ( ( ( line . indexOf ( "Content-Length:" ) ) + 16 ) , line . length ( ) ) ) . intValue ( ) ; } } if ( postindex > 0 ) { char [ ] array = new char [ postindex ] ; read . read ( array , 0 , postindex ) ; headerdata [ 4 ] = new String ( array ) ; } boolean isValidHeader = isValidHeader ( headerdata ) ; if ( isValidHeader ) { HttpClient client = new HttpClient ( headerdata ) ; SimpleServerEvent event = null ; if ( ( client . getUrl ( ) . isEmpty ( ) ) || ( client . getUrl ( ) . equalsIgnoreCase ( "//" ) ) ) { event = new SimpleServerEvent ( client , this , MimeType . MIME_HTML ) ; } else if ( ( ( client . getUrl ( ) . endsWith ( ".html" ) ) || ( client . getUrl ( ) . endsWith ( ".htm" ) ) ) || ( client . getUrl ( ) . endsWith ( ".php" ) ) ) { event = new SimpleServerEvent ( client , this , MimeType . MIME_HTML ) ; } else if ( ( ( client . getUrl ( ) . endsWith ( ".jpg" ) ) || ( client . getUrl ( ) . endsWith ( ".gif" ) ) ) || ( client . getUrl ( ) . endsWith ( ".png" ) ) ) { event = new SimpleServerEvent ( client , this , MimeType . MIME_JPEG ) ; } else if ( client . getUrl ( ) . endsWith ( ".json" ) ) { event = new SimpleServerEvent ( client , this , MimeType . MIME_JSON ) ; } else if ( client . getUrl ( ) . endsWith ( ".xml" ) ) { event = new SimpleServerEvent ( client , this , MimeType . MIME_XML ) ; } else { event = new SimpleServerEvent ( client , this , MimeType . MIME_PLAIN ) ; } callEvent ( event ) ; if ( ( event . isCancelled ( ) ) || ( ! ( event . hasContents ( ) ) ) ) { response . write ( "HTTP//1.1<seq2seq4repair_space>404<seq2seq4repair_space>Not<seq2seq4repair_space>Found\r\n" . getBytes ( ) ) ; response . flush ( ) ; } else { response . write ( "HTTP//1.1<seq2seq4repair_space>200<seq2seq4repair_space>OK\r\n" . getBytes ( ) ) ; response . write ( ( ( "Content-Type:<seq2seq4repair_space>" + ( event . getMimeType ( ) . getMimeType ( ) ) ) + "\r\n" ) . getBytes ( ) ) ; response . write ( ( ( "Content-Length:<seq2seq4repair_space>" + ( event . getContents ( ) . length ) ) + "\n\r" ) . getBytes ( ) ) ; <START_BUG> response . write ( "\n\r" . getBytes ( ) ) ; <END_BUG> response . flush ( ) ; response . write ( event . getContents ( ) ) ; response . flush ( ) ; } } response . close ( ) ; socket . close ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } private boolean isValidHeader ( String [ ] data ) { } @ Override public String getName ( ) { } }

Fix:
response . write ( "\n" . getBytes ( ) ) ;