@@ -0,0 +1,1707 @@
+package com.github.aureliano.achmed.server;%0A%0Aimport java.io.IOException;%0Aimport java.net.ServerSocket;%0Aimport java.net.Socket;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Aimport com.github.aureliano.achmed.common.StatusCode;%0Aimport com.github.aureliano.achmed.common.logging.LoggingFactory;%0A%0Apublic class AchmedServerHandler %7B%0A%0A%09private static final Logger logger = LoggingFactory.createLogger(AchmedServerHandler.class);%0A%09private static AchmedServerHandler instance;%0A%09%0A%09private Integer portNumber;%0A%09%0A%09private AchmedServerHandler() %7B%7D%0A%09%0A%09public static AchmedServerHandler instance() %7B%0A%09%09if (instance == null) %7B%0A%09%09%09instance = new AchmedServerHandler();%0A%09%09%7D%0A%09%09%0A%09%09return instance;%0A%09%7D%0A%09%0A%09public void startUp(Integer portNumber) %7B%0A%09%09this.configurePortNumber(portNumber);%0A%09%09%0A%09%09try (%0A%09%09%09ServerSocket serverSocket = new ServerSocket(portNumber);%0A%09%09) %7B%0A%09%09%09logger.info(%22Achmed server started and listening on port %22 + portNumber);%0A%09%09%09%0A%09%09%09while (true) %7B%0A%09%09%09%09Socket clientSocket = serverSocket.accept();%0A%09%09%09%09logger.info(%22Accepted connection from: %22 + clientSocket.getInetAddress().getHostAddress());%0A%09%09%09%09%0A%09%09%09%09clientSocket.close();%0A%09%09%09%09logger.info(%22Closed connection.%22);%0A%09%09%09%7D%0A%09%09%7D catch (IOException ex) %7B%0A%09%09%09logger.log(Level.SEVERE, ex.getMessage(), ex);%0A%09%09%09System.exit(StatusCode.SERVER_LISTEN_CONNECTION.getCode());%0A%09%09%7D%0A%09%7D%0A%09%0A%09public void shutDown() %7B%0A%09%09logger.info(%22Achmed server has just shut down.%22);%0A%09%7D%0A%09%0A%09private void configurePortNumber(Integer portNumber) %7B%0A%09%09this.portNumber = portNumber;%0A%09%09if ((this.portNumber == null) %7C%7C (this.portNumber %3C= 0)) %7B%0A%09%09%09logger.log(Level.SEVERE, %22Invalid port number: %22 + this.portNumber);%0A%09%09%09System.exit(StatusCode.CLI_PARAMETERS_ERROR.getCode());%0A%09%09%7D%0A%09%7D%0A%7D

Create server handler.