Skip to content
Snippets Groups Projects
Commit e1eb9caf authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

changes necessary to test communicateOneMessage()

parent c3a28e68
No related branches found
No related tags found
No related merge requests found
......@@ -11,14 +11,14 @@ import static java.lang.Thread.sleep;
public class Chat {
private static final int MAXIMUM_CONNECTION_ATTEMPTS = 10;
private final Socket socket;
private Socket socket;
private boolean isHost;
private ResourceBundle bundle;
private Set<String> keywords;
public Chat() {
setLocale(Locale.getDefault());
socket = connect(new Scanner(System.in));
socket = null;
}
/**
......@@ -45,7 +45,7 @@ public class Chat {
* @param userInput a {@link java.util.Scanner} to read user responses
* @return the {@link java.net.Socket} for the connection
*/
@SuppressWarnings("WeakerAccess")
@SuppressWarnings("UnusedReturnValue")
public Socket connect(Scanner userInput) {
String yes = bundle.getString("connection.response.yes");
String no = bundle.getString("connection.response.no");
......@@ -62,6 +62,7 @@ public class Chat {
System.err.println(bundle.getString("connection.error.generalConnectionFailure") + ": " + ioException);
System.exit(1);
}
this.socket = socket;
return socket;
}
......@@ -374,6 +375,7 @@ public class Chat {
public static void main(String[] args) {
Chat chat = new Chat();
chat.connect(new Scanner(System.in));
chat.communicate();
chat.disconnect();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment