//WebServer class constructor public WebServer(int port, String basePath) throws IOException { this.port = port; this.baseDir = new File(basePath); //connections = new LinkedList(); try { listener = new ServerSocket(port); //Connection conn; while (isRunning()) { new Connection(this, listener.accept()); } } catch (IOException e) { throw e; } } //Connection constructor and run() public Connection(WebServer mom, Socket client) { this.mom = mom; this.client = client; run(); } public void run() { try { InputStreamReader isReader; isReader = new InputStreamReader(client.getInputStream()); BufferedReader bReader = new BufferedReader(isReader); String input; while ((input = bReader.readLine()) != null) { payload.offer(input); System.out.println(input); } processPayload(); } catch (IOException e) { System.out.println(e.getMessage()); } }