NOTE: Make sure emojis are supported in your IDE environment; otherwise, will appear. If emojis are not installed, either install them or ignore the question marks () in the output.
mvn clean package
#This command runs the Main class, which initiates the scenario where both players communicate within the same Java process using threads. java -cp target/PlayersCommunication-1.0-SNAPSHOT.jar FirstScenario.Main
mvn clean package
Now first start the SecondPlayer(ServerPlayer) in terminal because The it act as a PlayerServer which needs to be running and listening for incoming connections before the FirstPlayer(ClientPlayer) attempts to connect. Therefore, If you start the FirstPlayer(clientPlayer) first, then it will try to connect to a SecondPlayer(ServerPlayer) that isn’t yet available, which could result in a connection failure.
java -cp target/PlayersCommunication-1.0-SNAPSHOT.jar SecondScenario.SecondPlayer
java -cp target/PlayersCommunication-1.0-SNAPSHOT.jar SecondScenario.FirstPlayer