public static void main(String args[]) {
        ServerSocket serverSocket;
        try {
            serverSocket = new ServerSocket(12129);
        } catch (Exception e) {
            System.err.println("Create server socket: " + e);
            return;
        }
        while (true) {
            try {
                Socket socket = serverSocket.accept();
                InputStream is = socket.getInputStream();
                BufferedReader br = new BufferedReader(new InputStreamReader(is));
                OutputStream os = socket.getOutputStream();
                PrintWriter pw = new PrintWriter(os, true);
                String fromClient = br.readLine();
                //System.out.println("From client: [" + fromClient + "]");
                //pw.println("Echo: " + fromClient);
                ScoresHandler sh = new ScoresHandler();
                switch(fromClient){
                    case CNetProtocol.TAKEMYSCORE:
                        String name = br.readLine();
                        System.out.println(name);
                        String score = br.readLine();
                        System.out.println(score);


                        if(sh.addScore(name, Integer.parseInt(score))){   //addScore() zwraca true gdy doda false gdy za niski wynik
                            pw.println(SNetProtocol.SCOREADDED);
                            System.out.println(SNetProtocol.SCOREADDED);
                        }else {
                            pw.println(SNetProtocol.SCORETOOLOW);
                            System.out.println(SNetProtocol.SCORETOOLOW);
                        }

                        break;

                    case CNetProtocol.GIVEMEHIGHSCORES:
                        Score[] scores = sh.getScores();
                        if(scores != null){
                            pw.println(SNetProtocol.HIGHSCORES);
                            System.out.println(SNetProtocol.HIGHSCORES);
                            for(int i=0;i<Config.HIGHSCORES_COUNT;i++){
                            pw.println(scores[i].getName());
                            pw.println(scores[i].getScore());
                            }
                        }else{
                            pw.println(SNetProtocol.NOSUCHFILE);
                            System.out.println(SNetProtocol.NOSUCHFILE);
                        }

                    case CNetProtocol.CHECKCONNECTION:
                        pw.println(SNetProtocol.OK);
                        System.out.println(SNetProtocol.OK);

                        break;

                }
                socket.close();
            } catch (Exception e) {
                System.err.println("Server exception: " + e);
            }
        }
    }