@@ -0,0 +1,2635 @@
+package learn_to_code.java_api.net.tiny_chat_over_local_socket;%0D%0A%0D%0Aimport java.io.IOException;%0D%0Aimport java.net.ServerSocket;%0D%0Aimport java.util.concurrent.ExecutorService;%0D%0Aimport java.util.concurrent.Executors;%0D%0A%0D%0A/**%0D%0A * This server will open port 10000 on your machine (Can be changed obviously), accept MULTIPLE connection%0D%0A * at once. When a new connection is established (When call to serverSocket.accept() returns), a thread is started%0D%0A * to work with this connection and then the server start listening to the port again.%0D%0A * %3Cbr%3E%0D%0A * The communication is defined by %7B@link learn_to_code.java_api.net.local_one_time_one_connection.SimpleNetworkProtocol%7D class%0D%0A * Client can be %7B@link learn_to_code.java_api.net.local_one_time_one_connection.SingleConnectionLocalClient%7D%0D%0A */%0D%0Apublic class LocalChatServer %7B%0D%0A%0D%0A    private static ExecutorService executor = Executors.newCachedThreadPool();%0D%0A%0D%0A    public static void main(String%5B%5D args) throws IOException %7B%0D%0A%0D%0A        try (ServerSocket serverSocket = new ServerSocket(10000)) %7B%0D%0A        %7D%0D%0A%0D%0A        /*%0D%0A        1. Start%0D%0A%0D%0A            %3E Hello%0D%0A            %3E I can do stuff%0D%0A            %3E 1. To login under existing user print %22login%22%0D%0A            %3E 2. To create new user print %22new%22%0D%0A%0D%0A            1.1.%0D%0A%0D%0A            Login %3C%0D%0A%0D%0A            1.1. Login%0D%0A                 %3E Your login?%0D%0A                login %3C%0D%0A%0D%0A                %3E Your password ?%0D%0A                password %3C%0D%0A%0D%0A                SERVER CHECKS IF USER EXISTS%0D%0A%0D%0A                1.1.1. User exists%0D%0A%0D%0A                    %3E Connected successfully!%0D%0A%0D%0A                    LOGIN SUCCESSFUL%0D%0A%0D%0A                1.1.2. User does not exist.%0D%0A%0D%0A                    %3E Login failure!%0D%0A%0D%0A                    GO BACK TO 1.%0D%0A%0D%0A%0D%0A            1.2. New user%0D%0A%0D%0A                new %3C%0D%0A                %3E New login?%0D%0A                login %3C%0D%0A%0D%0A                %3E New password ?%0D%0A                password %3C%0D%0A%0D%0A                CHECK IF LOGIN IS AVAILABLE%0D%0A%0D%0A                1.2.1. Login available%0D%0A%0D%0A                    SERVER IS CREATING NEW USER IN IT'S DATABASE(?).%0D%0A                    %3E New user created%0D%0A%0D%0A                    GO TO 2.%0D%0A%0D%0A                1.2.2. Login is not available%0D%0A%0D%0A                    %3E Login is not available, please try again%0D%0A%0D%0A                    GO TO 1.2.%0D%0A%0D%0A%0D%0A        2. Login successful%0D%0A            %3E Login successful. What would you like to do next?%0D%0A            %3E 1. To check your contact list print %22contacts%22%0D%0A            %3E 2. To connect to other online user print %22connect %25USER_LOGIN%25%22. Note: active users are marked with * after call to contacts.%0D%0A%0D%0A            ...%0D%0A%0D%0A        */%0D%0A    %7D%0D%0A%7D%0D%0A

Add new package and class for local chat example