private Command processCommand(Socket clientSocket) {
        BufferedReader in = null;
        BufferedWriter out = null;
        try{
            in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            out = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
            String s;
            while ((s = in.readLine()) != null) {
                if("exit".equalsIgnoreCase(s.trim())) {
                    respond(out, "ok");

                    return Command.EXIT;
                }else {
                    respond(out, String.format("Unknown command '%s'", s));
                }
            }
        }catch (IOException e) {
            log.warn(String.format("Failed to accept user command at port %d: %s", clientSocket.getPort(), e.getMessage()), e);
        }finally {
            try{
                Closeables.close(in, true);
                Closeables.close(out, true);
            } catch(IOException ignored) {

            }

        }

        return null;
    }
private Command processCommand ( Socket clientSocket ) { BufferedReader in = null ; BufferedWriter out = null ; try { in = new BufferedReader ( new InputStreamReader ( clientSocket . getInputStream ( ) ) ) ; out = new BufferedWriter ( new OutputStreamWriter ( clientSocket . getOutputStream ( ) ) ) ; String s ; while ( ( s = in . readLine ( ) ) != null ) { if ( "exit" . equalsIgnoreCase ( s . trim ( ) ) ) { respond ( out , "ok" ) ; return Command . EXIT ; } else { respond ( out , String . format ( "Unknown command '%s'" , s ) ) ; } } } catch ( IOException e ) { log . warn ( String . format ( "Failed to accept user command at port %d: %s" , clientSocket . getPort ( ) , e . getMessage ( ) ) , e ) ; } finally { try { Closeables . close ( in , true ) ; Closeables . close ( out , true ) ; } catch ( IOException ignored ) { } } return null ; }
Processes user command. For now it supports only "exit", case insensitive.
@param clientSocket The client socket after connection is established between a client and this server

@return the last processed command