public void run() {

            try (
                    PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
                    BufferedReader in = new BufferedReader(
                            new InputStreamReader(
                                    socket.getInputStream()))
            ) {
                String inputLine;
                java.lang.reflect.Type mapType = new TypeToken<HashMap<String, String>>(){
    			}.getType();
                Gson gson = new Gson();
                out.println("Connected");

                if (first == null){
                	// This is the first user.
                	identity = true;
                	first = out;
                }
                else {
                	// This is the second user.
                	identity = false;
                	second = out;
                }

                try{
                	// If the second client has connected, then we start the game.
                	if (!identity) {
                		long t = Calendar.getInstance().getTimeInMillis();
                		first.println("Start" + (t + 1000));
                		second.println("Start" + (t + 1000));
                	}
                	
                	// Continuously accept user data
                    while ((inputLine = in.readLine()) != null) {
                        if (inputLine.equals("Disconnect"))
                            break;
                    	// We parse the message
                        HashMap<String, String> pro = gson.fromJson(inputLine, mapType);
                        
                        // If the first client sent us the data, we send the data to the second client.
                        if (identity) {
	                        second.println(gson.toJson(pro, HashMap.class));
                        } else {
	                        first.println(gson.toJson(pro, HashMap.class));
                        }
                    }
                } catch (JsonSyntaxException e){
                    e.printStackTrace();
                } finally {
                    if(identity){
                    	first.close();
                    	first = null;
                    } else {
                    	second.close();
                    	second = null;
                    }
                }
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }