mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -19,7 +19,7 @@ import java.util.Timer;
|
|||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class DiscoveryServerClient {
|
public class DiscoveryServerClient {
|
||||||
private final Integer UPDATE_INTERVAL_MS = 700;
|
private final Integer UPDATE_INTERVAL_MS = 1000;
|
||||||
|
|
||||||
private static String roomCode = null;
|
private static String roomCode = null;
|
||||||
private Timer serverListingUpdateTimer;
|
private Timer serverListingUpdateTimer;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import seng302.utilities.GeoUtility;
|
|||||||
public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
||||||
|
|
||||||
private static final int PORT = 4942;
|
private static final int PORT = 4942;
|
||||||
|
private static int selectedPort = PORT;
|
||||||
private static final Integer CLIENT_UPDATES_PER_SECOND = 60;
|
private static final Integer CLIENT_UPDATES_PER_SECOND = 60;
|
||||||
private Logger logger = LoggerFactory.getLogger(MainServerThread.class);
|
private Logger logger = LoggerFactory.getLogger(MainServerThread.class);
|
||||||
private boolean terminated;
|
private boolean terminated;
|
||||||
@@ -40,7 +41,8 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
public MainServerThread() {
|
public MainServerThread() {
|
||||||
new GameState();
|
new GameState();
|
||||||
try {
|
try {
|
||||||
serverSocket = new ServerSocket(PORT);
|
serverSocket = new ServerSocket(0);
|
||||||
|
selectedPort = serverSocket.getLocalPort();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.trace("IO error in server thread handler upon trying to make new server socket",
|
logger.trace("IO error in server thread handler upon trying to make new server socket",
|
||||||
0);
|
0);
|
||||||
@@ -66,7 +68,7 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
.setMapName(regattaXMLData.getCourseName())
|
.setMapName(regattaXMLData.getCourseName())
|
||||||
.setCapacity(capacity)
|
.setCapacity(capacity)
|
||||||
.setNumberOfPlayers(numPlayers - 1)
|
.setNumberOfPlayers(numPlayers - 1)
|
||||||
.registerGame(PORT, regattaXMLData.getRegattaName());
|
.registerGame(selectedPort, regattaXMLData.getRegattaName());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("Could not register server");
|
logger.warn("Could not register server");
|
||||||
}
|
}
|
||||||
@@ -346,4 +348,8 @@ public class MainServerThread implements Runnable, ClientConnectionDelegate {
|
|||||||
public boolean hasStarted() {
|
public boolean hasStarted() {
|
||||||
return hasStarted;
|
return hasStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPortNumber() {
|
||||||
|
return selectedPort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class GameClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
startClientToServerThread("localhost", 4942);
|
startClientToServerThread("localhost", server.getPortNumber());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showConnectionError("Cannot connect to server as host");
|
showConnectionError("Cannot connect to server as host");
|
||||||
}
|
}
|
||||||
@@ -177,9 +177,11 @@ public class GameClient {
|
|||||||
|
|
||||||
this.lobbyController = ViewManager.getInstance().goToLobby(false);
|
this.lobbyController = ViewManager.getInstance().goToLobby(false);
|
||||||
|
|
||||||
|
lobbyController.setPortNumber(""+server.getPortNumber());
|
||||||
|
|
||||||
ViewManager.getInstance().setPlayerList(clientLobbyList);
|
ViewManager.getInstance().setPlayerList(clientLobbyList);
|
||||||
return new ServerDescription(serverName, regattaData.getCourseName(), GameState.getNumberOfPlayers(), GameState.getCapacity(),
|
return new ServerDescription(serverName, regattaData.getCourseName(), GameState.getNumberOfPlayers(), GameState.getCapacity(),
|
||||||
"localhost", 4942);
|
"localhost", server.getPortNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tearDownConnection() {
|
private void tearDownConnection() {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class MapMaker {
|
|||||||
private XMLGenerator xmlGenerator = new XMLGenerator();
|
private XMLGenerator xmlGenerator = new XMLGenerator();
|
||||||
|
|
||||||
private List<String> maps = new ArrayList<>(
|
private List<String> maps = new ArrayList<>(
|
||||||
Arrays.asList("default.xml", "horseshoe.xml", "loop.xml", "madagascar.xml"));
|
Arrays.asList("default.xml", "horseshoe.xml", "loop.xml", "madagascar.xml", "waiheke.xml"));
|
||||||
|
|
||||||
public static MapMaker getInstance() {
|
public static MapMaker getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ public class LobbyController implements Initializable {
|
|||||||
@FXML
|
@FXML
|
||||||
private Label roomLabel;
|
private Label roomLabel;
|
||||||
@FXML
|
@FXML
|
||||||
|
private Label portNumber;
|
||||||
|
@FXML
|
||||||
private Pane speedTokenPane, handlingTokenPane, windWalkerTokenPane, bumperTokenPane, randomTokenPane;
|
private Pane speedTokenPane, handlingTokenPane, windWalkerTokenPane, bumperTokenPane, randomTokenPane;
|
||||||
//---------FXML END---------//
|
//---------FXML END---------//
|
||||||
|
|
||||||
@@ -85,6 +87,8 @@ public class LobbyController implements Initializable {
|
|||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
roomLabel.setText("");
|
roomLabel.setText("");
|
||||||
|
portNumber.setText("");
|
||||||
|
|
||||||
this.playerBoats = ViewManager.getInstance().getGameClient().getAllBoatsMap();
|
this.playerBoats = ViewManager.getInstance().getGameClient().getAllBoatsMap();
|
||||||
|
|
||||||
if (this.playersColor == null) {
|
if (this.playersColor == null) {
|
||||||
@@ -376,4 +380,8 @@ public class LobbyController implements Initializable {
|
|||||||
public void setRoomCode(String roomCode) {
|
public void setRoomCode(String roomCode) {
|
||||||
roomLabel.setText("Room: " + roomCode);
|
roomLabel.setText("Room: " + roomCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPortNumber(String p){
|
||||||
|
portNumber.setText("Port: " + p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RaceDefinition>
|
||||||
|
|
||||||
|
<CourseName>Waiheke</CourseName>
|
||||||
|
|
||||||
|
<CentralLat>-36.80008</CentralLat>
|
||||||
|
<CentralLng>175.012225</CentralLng>
|
||||||
|
|
||||||
|
<MaxPlayers>10</MaxPlayers>
|
||||||
|
|
||||||
|
<Marks>
|
||||||
|
<CompoundMark CompoundMarkID="1">
|
||||||
|
<Mark Lat="-36.79512" Lng="175.0116"/>
|
||||||
|
<Mark Lat="-36.79468" Lng="175.01312"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="2">
|
||||||
|
<Mark Lat="-36.80069" Lng="175.01495"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="3">
|
||||||
|
<Mark Lat="-36.79892" Lng="175.01832"/>
|
||||||
|
<Mark Lat="-36.79988" Lng="175.01913"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="4">
|
||||||
|
<Mark Lat="-36.80064" Lng="175.01171"/>
|
||||||
|
<Mark Lat="-36.80186" Lng="175.0124"/>
|
||||||
|
</CompoundMark>
|
||||||
|
<CompoundMark CompoundMarkID="5">
|
||||||
|
<Mark Lat="-36.79579" Lng="175.01194"/>
|
||||||
|
<Mark Lat="-36.79545" Lng="175.01349"/>
|
||||||
|
</CompoundMark>
|
||||||
|
</Marks>
|
||||||
|
|
||||||
|
<Course>
|
||||||
|
<OpeningSegment>
|
||||||
|
<Corner CompoundMarkID="1" Rounding="PS"/>
|
||||||
|
<Corner CompoundMarkID="2" Rounding="P"/>
|
||||||
|
</OpeningSegment>
|
||||||
|
|
||||||
|
<RepeatingSegment>
|
||||||
|
<Corner CompoundMarkID="3" Rounding="SP"/>
|
||||||
|
<Corner CompoundMarkID="4" Rounding="PS"/>
|
||||||
|
</RepeatingSegment>
|
||||||
|
|
||||||
|
<ClosingSegment>
|
||||||
|
<Corner CompoundMarkID="5" Rounding="PS"/>
|
||||||
|
</ClosingSegment>
|
||||||
|
</Course>
|
||||||
|
|
||||||
|
<CourseLimit>
|
||||||
|
<Limit Lat="-36.7938" Lng="175.01194"/>
|
||||||
|
<Limit Lat="-36.79411" Lng="175.01555"/>
|
||||||
|
<Limit Lat="-36.79765" Lng="175.01898"/>
|
||||||
|
<Limit Lat="-36.79909" Lng="175.02149"/>
|
||||||
|
<Limit Lat="-36.80163" Lng="175.02014"/>
|
||||||
|
<Limit Lat="-36.80292" Lng="175.0175"/>
|
||||||
|
<Limit Lat="-36.80325" Lng="175.01008"/>
|
||||||
|
<Limit Lat="-36.80107" Lng="175.0089"/>
|
||||||
|
<Limit Lat="-36.79567" Lng="175.00961"/>
|
||||||
|
</CourseLimit>
|
||||||
|
|
||||||
|
</RaceDefinition>
|
||||||
@@ -66,6 +66,11 @@
|
|||||||
<GridPane.margin>
|
<GridPane.margin>
|
||||||
<Insets right="20.0" top="10.0" />
|
<Insets right="20.0" top="10.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
|
</Label>
|
||||||
|
<Label fx:id="portNumber" text="Port: 4191" GridPane.columnIndex="2" GridPane.halignment="RIGHT" GridPane.rowIndex="1">
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets right="20.0" top="-15.0" />
|
||||||
|
</GridPane.margin>
|
||||||
</Label>
|
</Label>
|
||||||
</children>
|
</children>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
@@ -80,12 +85,9 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
<GridPane GridPane.rowIndex="1">
|
<GridPane GridPane.rowIndex="1">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="NEVER" maxWidth="-Infinity" minWidth="-Infinity"
|
<ColumnConstraints hgrow="NEVER" maxWidth="-Infinity" minWidth="-Infinity" prefWidth="115.0" />
|
||||||
prefWidth="115.0"/>
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="337.0" prefWidth="430.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308"
|
<ColumnConstraints hgrow="NEVER" maxWidth="350.0" minWidth="350.0" prefWidth="350.0" />
|
||||||
minWidth="337.0" prefWidth="430.0"/>
|
|
||||||
<ColumnConstraints hgrow="NEVER" maxWidth="350.0" minWidth="350.0"
|
|
||||||
prefWidth="350.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints vgrow="SOMETIMES" />
|
<RowConstraints vgrow="SOMETIMES" />
|
||||||
@@ -110,116 +112,92 @@
|
|||||||
<Insets bottom="15.0" left="7.0" right="7.0" top="15.0" />
|
<Insets bottom="15.0" left="7.0" right="7.0" top="15.0" />
|
||||||
</GridPane.margin>
|
</GridPane.margin>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<GridPane prefHeight="370.0" prefWidth="189.0" styleClass="tokenGridView"
|
<GridPane prefHeight="370.0" prefWidth="189.0" styleClass="tokenGridView" vgap="5.0">
|
||||||
vgap="5.0">
|
|
||||||
<children>
|
<children>
|
||||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Tokens"
|
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Tokens" GridPane.halignment="CENTER">
|
||||||
GridPane.halignment="CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="18.0"/>
|
<Font name="System Bold" size="18.0" />
|
||||||
</font>
|
</font>
|
||||||
</Text>
|
</Text>
|
||||||
<StackPane prefHeight="150.0" prefWidth="200.0"
|
<StackPane prefHeight="150.0" prefWidth="200.0" GridPane.rowIndex="1">
|
||||||
GridPane.rowIndex="1">
|
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="BOTTOM_CENTER" text="Speed"
|
<Label alignment="BOTTOM_CENTER" text="Speed" StackPane.alignment="BOTTOM_CENTER">
|
||||||
StackPane.alignment="BOTTOM_CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="12.0"/>
|
<Font size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0"/>
|
<Insets bottom="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Pane fx:id="speedTokenPane" prefHeight="999.0"
|
<Pane fx:id="speedTokenPane" prefHeight="999.0" prefWidth="200.0" styleClass="tokenView" />
|
||||||
prefWidth="200.0" styleClass="tokenView"/>
|
|
||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<StackPane prefHeight="150.0" prefWidth="200.0"
|
<StackPane prefHeight="150.0" prefWidth="200.0" GridPane.rowIndex="2">
|
||||||
GridPane.rowIndex="2">
|
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="BOTTOM_CENTER" text="Handling"
|
<Label alignment="BOTTOM_CENTER" text="Handling" StackPane.alignment="BOTTOM_CENTER">
|
||||||
StackPane.alignment="BOTTOM_CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="12.0"/>
|
<Font size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0"/>
|
<Insets bottom="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Pane fx:id="handlingTokenPane" prefHeight="999.0"
|
<Pane fx:id="handlingTokenPane" prefHeight="999.0" prefWidth="200.0" styleClass="tokenView" />
|
||||||
prefWidth="200.0" styleClass="tokenView"/>
|
|
||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<StackPane prefHeight="150.0" prefWidth="200.0"
|
<StackPane prefHeight="150.0" prefWidth="200.0" GridPane.rowIndex="3">
|
||||||
GridPane.rowIndex="3">
|
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="BOTTOM_CENTER" text="Wind Walker"
|
<Label alignment="BOTTOM_CENTER" text="Wind Walker" StackPane.alignment="BOTTOM_CENTER">
|
||||||
StackPane.alignment="BOTTOM_CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="12.0"/>
|
<Font size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0"/>
|
<Insets bottom="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Pane fx:id="windWalkerTokenPane" prefHeight="999.0"
|
<Pane fx:id="windWalkerTokenPane" prefHeight="999.0" prefWidth="200.0" styleClass="tokenView" />
|
||||||
prefWidth="200.0" styleClass="tokenView"/>
|
|
||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<StackPane prefHeight="150.0" prefWidth="200.0"
|
<StackPane prefHeight="150.0" prefWidth="200.0" GridPane.rowIndex="4">
|
||||||
GridPane.rowIndex="4">
|
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="BOTTOM_CENTER" text="Bumper"
|
<Label alignment="BOTTOM_CENTER" text="Bumper" StackPane.alignment="BOTTOM_CENTER">
|
||||||
StackPane.alignment="BOTTOM_CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="12.0"/>
|
<Font size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0"/>
|
<Insets bottom="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Pane fx:id="bumperTokenPane" prefHeight="999.0"
|
<Pane fx:id="bumperTokenPane" prefHeight="999.0" prefWidth="200.0" styleClass="tokenView" />
|
||||||
prefWidth="200.0" styleClass="tokenView"/>
|
|
||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
<StackPane prefHeight="150.0" prefWidth="200.0"
|
<StackPane prefHeight="150.0" prefWidth="200.0" GridPane.rowIndex="5">
|
||||||
GridPane.rowIndex="5">
|
|
||||||
<children>
|
<children>
|
||||||
<Label alignment="BOTTOM_CENTER" text="Random"
|
<Label alignment="BOTTOM_CENTER" text="Random" StackPane.alignment="BOTTOM_CENTER">
|
||||||
StackPane.alignment="BOTTOM_CENTER">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="12.0"/>
|
<Font size="12.0" />
|
||||||
</font>
|
</font>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="5.0"/>
|
<Insets bottom="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</Label>
|
</Label>
|
||||||
<Pane fx:id="randomTokenPane" prefHeight="999.0"
|
<Pane fx:id="randomTokenPane" prefHeight="999.0" prefWidth="60.0" styleClass="tokenView" />
|
||||||
prefWidth="60.0" styleClass="tokenView"/>
|
|
||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
</children>
|
</children>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="80.0"
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="80.0" minWidth="80.0" prefWidth="80.0" />
|
||||||
prefWidth="80.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="15.0" left="15.0" right="7.0" top="15.0"/>
|
<Insets bottom="15.0" left="15.0" right="7.0" top="15.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints maxHeight="116.0" minHeight="0.0" prefHeight="40.0"
|
<RowConstraints maxHeight="116.0" minHeight="0.0" prefHeight="40.0" vgrow="NEVER" />
|
||||||
vgrow="NEVER"/>
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||||
prefHeight="60.0" vgrow="SOMETIMES"/>
|
<RowConstraints maxHeight="141.0" minHeight="-Infinity" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||||
prefHeight="60.0" vgrow="SOMETIMES"/>
|
<RowConstraints maxHeight="285.0" minHeight="-Infinity" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints maxHeight="141.0" minHeight="-Infinity"
|
|
||||||
prefHeight="60.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
|
||||||
prefHeight="60.0" vgrow="SOMETIMES"/>
|
|
||||||
<RowConstraints maxHeight="285.0" minHeight="-Infinity"
|
|
||||||
prefHeight="60.0" vgrow="SOMETIMES"/>
|
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
@@ -236,7 +214,7 @@
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<URL value="@../css/Master.css"/>
|
<URL value="@../css/Master.css" />
|
||||||
<URL value="@../css/LobbyView.css"/>
|
<URL value="@../css/LobbyView.css" />
|
||||||
</stylesheets>
|
</stylesheets>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class DisconnectionTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testServerDisconnection () throws Exception {
|
public void testServerDisconnection () throws Exception {
|
||||||
MainServerThread serverThread = new MainServerThread();
|
MainServerThread serverThread = new MainServerThread();
|
||||||
ClientToServerThread clientThread = new ClientToServerThread("localhost", 4942);
|
ClientToServerThread clientThread = new ClientToServerThread("localhost", serverThread.getPortNumber());
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
clientThread.addDisconnectionListener(message -> Assert.assertTrue(message != null));
|
clientThread.addDisconnectionListener(message -> Assert.assertTrue(message != null));
|
||||||
serverThread.terminate();
|
serverThread.terminate();
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class RegularPacketsTest {
|
|||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
new GameState();
|
new GameState();
|
||||||
serverThread = new MainServerThread();
|
serverThread = new MainServerThread();
|
||||||
clientThread = new ClientToServerThread("localhost", 4942);
|
clientThread = new ClientToServerThread("localhost", serverThread.getPortNumber());
|
||||||
GameState.setCurrentStage(GameStages.RACING);
|
GameState.setCurrentStage(GameStages.RACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class SendChatSteps {
|
|||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
host = new ClientToServerThread("localhost", 4942);
|
host = new ClientToServerThread("localhost", mst.getPortNumber());
|
||||||
host.addStreamObserver(() -> {
|
host.addStreamObserver(() -> {
|
||||||
while (host.getPacketQueue().peek() != null) {
|
while (host.getPacketQueue().peek() != null) {
|
||||||
StreamPacket packet = host.getPacketQueue().poll();
|
StreamPacket packet = host.getPacketQueue().poll();
|
||||||
@@ -68,7 +68,7 @@ public class SendChatSteps {
|
|||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
client = new ClientToServerThread("localhost", 4942);
|
client = new ClientToServerThread("localhost", mst.getPortNumber());
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class ToggleSailSteps {
|
|||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
ie.printStackTrace();
|
ie.printStackTrace();
|
||||||
}
|
}
|
||||||
client = new ClientToServerThread("localhost", 4942);
|
client = new ClientToServerThread("localhost", mst.getPortNumber());
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
|
|||||||
Reference in New Issue
Block a user