// javac Server.java && java Server [port=8080] [host=127.0.0.1]

import java.net.*;
import java.io.*;

public class Server {
  public static void main(String[] argv) throws IOException {
    String host = "127.0.0.1";
    short port = 8080;

    if(argv.length >= 2)
      host = argv[1];

    if(argv.length >= 1)
      port = Short.parseShort(argv[0]);

    ServerSocket server = null;

    try {
      server = new ServerSocket(port, 0, InetAddress.getByName(host));

      System.err.println("Server listening on " + host + ":" + port + "\n");

      while(true) {
        Socket client = server.accept();
        PrintWriter out = new PrintWriter(client.getOutputStream(), true);
        BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));

        String input;

        while(!(input = in.readLine()).equals(""))
          System.out.println(input);

        System.out.println("");

        out.write("HTTP/1.1 200 OK");
        out.close();
        in.close();
        client.close();
      }
    }
    finally {
      System.out.println("Closing");
      if(server != null)
        server.close();
    }
  }
}

@@ -541,16 +541,70 @@
 + %22%5Cn%22);
+%0A      int read;%0A      byte%5B%5D buffer = new byte%5B8192%5D;
 %0A%0A      
@@ -654,24 +654,115 @@
 r.accept();%0A
+        System.out.println(%22Connection accepted from %22 + client.getRemoteSocketAddress());%0A
         Prin
@@ -836,51 +836,8 @@
     
-BufferedReader in = new BufferedReader(new 
 Inpu
@@ -847,15 +847,14 @@
 ream
-Reader(
+ in = 
 clie
@@ -876,33 +876,8 @@
 am()
-));%0A%0A        String input
 ;%0A%0A 
@@ -893,15 +893,13 @@
 ile(
-!(input
+(read
  = i
@@ -908,27 +908,24 @@
 read
-Line()).equals(%22%22))
+(buffer)) %3E 0) %7B
 %0A   
@@ -946,23 +946,41 @@
 out.
-println(input);
+write(buffer, 0, read);%0A        %7D
 %0A%0A  

Improve the java server