Added TcpServerTest

This commit is contained in:
lieght
2025-09-20 18:32:34 +02:00
parent 8ee378cf82
commit a99e08f726
4 changed files with 119 additions and 4 deletions

View File

@@ -202,6 +202,12 @@ public class ParsedCommand {
}
}
}
@Override
public String toString() {
return this.originalCommand; // TODO: Maybe return more info.
}
//
// public ParsedCommand parseCommand(String command) {
// return null;

View File

@@ -76,7 +76,7 @@ public final class ServerConnection extends TcpClient implements Runnable {
this.executor.shutdownNow();
}
private void inputLoop() {
void inputLoop() {
logger.info("Starting {}:{} connection read", this.serverAddress, this.serverPort);
try {
while (running) {
@@ -96,7 +96,7 @@ public final class ServerConnection extends TcpClient implements Runnable {
}
}
private void outputLoop() {
void outputLoop() {
logger.info("Starting {}:{} connection write", this.serverAddress, this.serverPort);
try {
while (this.running) {

View File

@@ -40,11 +40,11 @@ public abstract class TcpClient {
this.socket.close();
}
private BufferedReader createIn() throws IOException {
BufferedReader createIn() throws IOException {
return new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
}
private PrintWriter createOut() throws IOException {
PrintWriter createOut() throws IOException {
return new PrintWriter(this.socket.getOutputStream(), true);
}