Buggy code:
socketThread2 . setLock ( gameSetupReadyLock ) ; synchronized ( gameSetupReadyLock ) { while ( ( gameSetupReadyLock . getCounter ( ) ) != 2 ) { gameSetupReadyLock . wait ( ) ; System . out . println ( ( ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>setup<seq2seq4repair_space>lock<seq2seq4repair_space>waked<seq2seq4repair_space>" ) + ( gameSetupReadyLock . getCounter ( ) ) ) + "<seq2seq4repair_space>time" ) ) ; } } socketThread1 . writeViaSocket ( SERVER_START_GAME_SETUP ) ; socketThread2 . writeViaSocket ( SERVER_START_GAME_SETUP ) ; CustomLock gameStartReadyLock = new CustomLock ( CustomLock . GAME_START_READY_LOCK ) ; socketThread1 . setLock ( gameStartReadyLock ) ; socketThread2 . setLock ( gameStartReadyLock ) ; System . out . println ( ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>current<seq2seq4repair_space>counter<seq2seq4repair_space>is<seq2seq4repair_space>" ) + ( gameStartReadyLock . getCounter ( ) ) ) ) ; synchronized ( gameStartReadyLock ) { while ( ( gameStartReadyLock . getCounter ( ) ) != 2 ) { gameStartReadyLock . wait ( ) ; System . out . println ( ( ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>start<seq2seq4repair_space>lock<seq2seq4repair_space>waked<seq2seq4repair_space>" ) + ( gameStartReadyLock . getCounter ( ) ) ) + "<seq2seq4repair_space>time" ) ) ; } } socketThread1 . writeViaSocket ( SERVER_START_GAME ) ; socketThread2 . writeViaSocket ( SERVER_START_GAME ) ; if ( ( Math . random ( ) ) < 0.5 ) { currentPlayer = socketThread1 ; } else { currentPlayer = socketThread2 ; } currentPlayer . writeViaSocket ( SERVER_GRANT_TURN ) ; } catch ( IOException e1 ) { e1 . printStackTrace ( ) ; } catch ( InterruptedException e ) { } } private void print ( String input , int forwardNumber ) { } private void forwardBoardGame ( BoardGame boardGame , int forwardNumber ) { } private void setupClient ( ) { } protected void setServerSocket ( ServerSocket serverSocket ) { } protected ServerSocket getServerSocket ( ) { } protected boolean isWithLocalClient ( ) { } protected void setLocalClient ( Main . GameClient localClient ) { } protected class SocketThread extends Thread { Socket socket ; PrintWriter out ; BufferedReader in ; ObjectOutputStream oos ; ObjectInputStream ois ; GameServer gameServer ; int clientNumber ; private CustomLock currentLock ; public SocketThread ( Socket socket , GameServer gameServer ) { } public void setLock ( CustomLock newLock ) { } public void setClientNumber ( int clientNumber ) { } public CustomLock getCurrentLock ( ) { } public void writeViaSocket ( String string ) { } public void writeObjectViaSocket ( Object object ) { } @ Override public void run ( ) { while ( true ) { String input ; try { out = new PrintWriter ( socket . getOutputStream ( ) , true ) ; in = new BufferedReader ( new InputStreamReader ( socket . getInputStream ( ) ) ) ; System . out . println ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>running" ) ) ; if ( ( secondClientSocket ) == null ) { System . out . println ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>The<seq2seq4repair_space>second<seq2seq4repair_space>client<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>available" ) ) ; out . println ( SERVER_OTHER_CLIENT_NOT_AVAILABLE ) ; System . out . println ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>SERVER_OTHER_CLIENT_NOT_AVAILABLE<seq2seq4repair_space>sent" ) ) ; synchronized ( currentLock ) { while ( ! ( currentLock . wasSignaled ( ) ) ) { currentLock . wait ( ) ; } System . out . println ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>waked" ) ) ; } } out . println ( SERVER_OTHER_CLIENT_AVAILABLE ) ; while ( ( input = in . readLine ( ) ) != null ) { System . out . println ( ( ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>" ) + input ) + "<seq2seq4repair_space>received" ) ) ; switch ( input ) { case CommandString . CLIENT_GAME_SETUP_READY : if ( currentLock . getLockName ( ) . equals ( GAME_SETUP_READY_LOCK ) ) { synchronized ( currentLock ) { currentLock . incrementCounter ( ) ; currentLock . notify ( ) ; } break ; } else { System . out . println ( ( ( "Invalid<seq2seq4repair_space>lock,<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>" + ( CustomLock . GAME_SETUP_READY_LOCK ) ) + "..." ) ) ; break ; } case CommandString . CLIENT_GAME_START_READY : if ( currentLock . getLockName ( ) . equals ( GAME_START_READY_LOCK ) ) { if ( ( currentLock . getCounter ( ) ) == 0 ) { System . out . println ( ( ( Thread . currentThread ( ) . getName ( ) ) + ":<seq2seq4repair_space>The<seq2seq4repair_space>other<seq2seq4repair_space>client<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>ready" ) ) ; out . println ( SERVER_OPPONENT_NOT_READY ) ; } synchronized ( currentLock ) { currentLock . incrementCounter ( ) ; currentLock . notify ( ) ; } } else { } break ; case CommandString . CLIENT_WIN : if ( ( clientNumber ) == 1 ) print ( SERVER_INDICATE_YOU_LOSE , 2 ) ; else <START_BUG> print ( SERVER_INDICATE_YOU_WIN , 1 ) ; <END_BUG> case CommandString . CLIENT_LOSE : if ( ( clientNumber ) == 1 ) print ( SERVER_INDICATE_YOU_WIN , 2 ) ; else print ( SERVER_INDICATE_YOU_WIN , 1 ) ; default : if ( ( input . indexOf ( "RETURN_MARK" ) ) != ( - 1 ) ) { if ( ( clientNumber ) == 1 ) print ( input , 2 ) ; else print ( input , 1 ) ; } if ( ( input . indexOf ( "MARK" ) ) != ( - 1 ) ) { if ( ( clientNumber ) == 1 ) print ( input , 2 ) ; else print ( input , 1 ) ; } } } } catch ( IOException e ) { e . printStackTrace ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } } } No newline ; at end ; of file ; }

Fix:
print ( SERVER_INDICATE_YOU_LOSE , 1 ) ;