Remove System.exit in Client.scala and add a test