package org.i2bs.facilehttpd;

import java.net.ServerSocket;
import java.net.Socket;

import org.i2bs.facilehttpd.WorkerThread;

public class FacileHttpd {
  private ServerSocket ssock;

  public FacileHttpd() {
    try {
      ssock = new ServerSocket(8080);
    } catch (Exception e) {
      System.out.println(e);
    }
  }

  public void start() {
    try {
      while (true) {
        Socket sock = ssock.accept();
        WorkerThread worker = new WorkerThread(sock);
        worker.start();
      }
    } catch (Exception e) {
      System.out.println(e);
    }
  }

  public static void main(String[] args) {
    FacileHttpd server = new FacileHttpd();
    server.start();
  }
}

@@ -560,32 +560,155 @@
 (e);%0A    %7D%0A  %7D%0A%0A
+  public void close() %7B%0A    try %7B%0A      ssock.close();%0A    %7D catch (Exception e) %7B%0A      System.out.println(e);%0A    %7D%0A  %7D%0A%0A
   public static 
@@ -738,16 +738,22 @@
 ) %7B%0A    
+final 
 FacileHt
@@ -780,24 +780,145 @@
 ileHttpd();%0A
+    Runtime.getRuntime().addShutdownHook(new Thread()%7B%0A      public void run() %7B%0A        server.close();%0A      %7D%0A    %7D);%0A
     server.s

add shutdown hook