package net.zephyrizing.http_server;

public class HttpServer {

    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();
    }

    // Actual class begins

    private HttpServerSocket serveSocket;
    private int port;

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

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

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();
    }
}

--- 
+++ 
@@ -1,18 +1,6 @@
 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;
@@ -28,4 +16,18 @@
 
         server.listen();
     }
+
+    // Actual class begins
+
+    private HttpServerSocket serveSocket;
+    private int port;
+
+    public HttpServer(HttpServerSocket serveSocket, int port) {
+        this.serveSocket = serveSocket;
+        this.port = port;
+    }
+
+    public void listen() {
+        serveSocket.bind(port);
+    }
 }
Move main method to top of class
