Fixed disconnection issues. Fix is only temporary until a consistent interface for disconnections exists.

#bug #implement
This commit is contained in:
Calum
2017-08-17 14:02:18 +12:00
parent ef2659a7b9
commit 0276911b88
8 changed files with 92 additions and 43 deletions
@@ -0,0 +1,20 @@
package seng302.visualiser.ClientToServerTests;
import org.junit.Assert;
import org.junit.Test;
import seng302.gameServer.MainServerThread;
import seng302.visualiser.ClientToServerThread;
/**
* Created by cir27 on 17/08/17.
*/
public class DisconnectionTest {
@Test
public void testServerDisconnection () throws Exception {
MainServerThread serverThread = new MainServerThread();
ClientToServerThread clientThread = new ClientToServerThread("localhost", 4942);
Thread.sleep(1000);
clientThread.addDisconnectionListener(message -> Assert.assertTrue(message != null));
serverThread.terminate();
}
}
@@ -61,7 +61,7 @@ public class RegularPacketsTest {
// SleepThreadMaxDelay();
// ServerYacht yacht = new ArrayList<>(GameState.getYachts().values()).get(0);
// boolean startState = yacht.getSailIn();
// clientThread.sendBoatActionMessage(BoatAction.SAILS_IN);
// clientThread.sendBoatAction(BoatAction.SAILS_IN);
// SleepThreadMaxDelay();
// Assert.assertEquals(startState, !yacht.getSailIn());
// }
+1 -1
View File
@@ -36,7 +36,7 @@ public class ToggleSailSteps {
public void the_user_has_pressed(String arg1) throws Throwable {
startTime = System.currentTimeMillis();
if (arg1 == "shift") {
client.sendBoatActionMessage(BoatAction.SAILS_IN);
client.sendBoatAction(BoatAction.SAILS_IN);
}
}