package net.zephyrizing.http_server;

public class HttpServer {

    private HttpServerSocket serveSocket;
    private int port;

    public HttpServer(HttpServerSocket serveSocket, int port) {
        this.serveSocket = serveSocket;
        this.port = port;
    }

    public void listen() {
        serveSocket.bind(port);
    }

    public static void main(String[] args) {
        int portNumber;
        if (args.length == 1) {
            portNumber = Integer.parseInt(args[0]);
        } else {
            portNumber = 5000;
        }
        System.err.format("Starting server on port %d...", portNumber);

        HttpServerSocket httpSocket = new HttpServerSocketImpl();
        HttpServer server = new HttpServer(httpSocket, portNumber);

        server.listen();
    }
}

@@ -62,276 +62,8 @@
  %7B%0A%0A
-    private HttpServerSocket serveSocket;%0A    private int port;%0A%0A    public HttpServer(HttpServerSocket serveSocket, int port) %7B%0A        this.serveSocket = serveSocket;%0A        this.port = port;%0A    %7D%0A%0A    public void listen() %7B%0A        serveSocket.bind(port);%0A    %7D%0A%0A
     
@@ -507,11 +507,307 @@
 );%0A    %7D
+%0A%0A    // Actual class begins%0A%0A    private HttpServerSocket serveSocket;%0A    private int port;%0A%0A    public HttpServer(HttpServerSocket serveSocket, int port) %7B%0A        this.serveSocket = serveSocket;%0A        this.port = port;%0A    %7D%0A%0A    public void listen() %7B%0A        serveSocket.bind(port);%0A    %7D
 %0A%7D%0A

Move main method to top of class