WIP: Fazendo testes

This commit is contained in:
GustavoHMDS committed 2026-10-07 20:38:57 -03:00
1 parent 581a924afc
commit e5eb4f3f9c
3 files changed
+9 -2

No files matched your search

@@ -1 +0,0 @@
plugin.MultiProtocolChat
+5 -1
View File
@@ -262,6 +262,7 @@ public class SocketTCP extends Thread {
* @param connection conexão cujo fluxo de entrada será processado.
*/
private void startReceiver(TcpConnection connection) {
System.out.println("Starting TCP connection receiver.");
if (!connection.isPrivate()) {
publicConnectionReceiver(connection);
@@ -273,8 +274,10 @@ public class SocketTCP extends Thread {
return;
}
if (pluginManager.handleConnection(connection, connection.getReceiver()))
if (pluginManager.handleConnection(connection, connection.getReceiver())) {
System.out.println("Private connection receiver established.");
privateConnectionReceiver(connection);
}
else {
InfoMessage.sendSystemInfo(
connection,
@@ -348,6 +351,7 @@ public class SocketTCP extends Thread {
while (running) {
try {
byte[] message = connection.receive();
System.out.println("Um plugin recebeu uma mensagem");
InfoMessage sysMessage = InfoMessage.parseSystemInfo(message);
if (sysMessage == null) {
@@ -60,6 +60,8 @@ public class TcpConnection {
output.write(message);
output.flush();
updateLastActivity();
System.out.println("TcpConnection enviou uma mensagem de tamanho: " + message.length);
}
/**
@@ -75,6 +77,8 @@ public class TcpConnection {
byte[] receive() throws IOException {
int length = input.readInt();
System.out.println("TcpConnection recebeu uma mensagem de tamanho: " + length);
if (length < 0) throw new IOException("Invalid message length.");
byte[] message = input.readNBytes(length);