diff --git a/src/main/java/envoy/server/Startup.java b/src/main/java/envoy/server/Startup.java
index 7132343..13cd852 100644
--- a/src/main/java/envoy/server/Startup.java
+++ b/src/main/java/envoy/server/Startup.java
@@ -8,6 +8,7 @@ import com.jenkov.nioserver.Server;
import envoy.server.data.ConfigItem;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectMessageProcessor;
import envoy.server.net.ObjectMessageReader;
import envoy.server.processors.*;
diff --git a/src/main/java/envoy/server/database/PersistenceManager.java b/src/main/java/envoy/server/database/PersistenceManager.java
index 07103e0..12ac446 100644
--- a/src/main/java/envoy/server/database/PersistenceManager.java
+++ b/src/main/java/envoy/server/database/PersistenceManager.java
@@ -8,10 +8,10 @@ import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import envoy.data.User.UserStatus;
-import envoy.server.ConnectionManager;
import envoy.server.data.ConfigItem;
import envoy.server.data.Message;
import envoy.server.data.User;
+import envoy.server.net.ConnectionManager;
/**
* Project: envoy-server-standalone
diff --git a/src/main/java/envoy/server/ConnectionManager.java b/src/main/java/envoy/server/net/ConnectionManager.java
similarity index 93%
rename from src/main/java/envoy/server/ConnectionManager.java
rename to src/main/java/envoy/server/net/ConnectionManager.java
index e367be4..9419ed3 100644
--- a/src/main/java/envoy/server/ConnectionManager.java
+++ b/src/main/java/envoy/server/net/ConnectionManager.java
@@ -1,4 +1,4 @@
-package envoy.server;
+package envoy.server.net;
import java.util.*;
@@ -46,14 +46,14 @@ public class ConnectionManager implements ISocketIdListener {
@Override
public void socketCancelled(long socketId) {
if (!pendingSockets.remove(socketId)) {
- // notifying contacts of this users offline-going
+ // Notify contacts of this users offline-going
envoy.server.data.User user = PersistenceManager.getInstance().getUserById(getUserIdBySocketId(socketId));
user.setStatus(UserStatus.OFFLINE);
user.setLastSeen(new Date());
UserStatusChangeProcessor.updateUserStatus(user);
- // removing the socket
- sockets.entrySet().stream().filter(e -> e.getValue() == socketId).forEach(e -> sockets.remove(e.getValue()));
+ // Remove the socket
+ sockets.entrySet().removeIf(e -> e.getValue() == socketId);
}
}
diff --git a/src/main/java/envoy/server/processors/ContactOperationProcessor.java b/src/main/java/envoy/server/processors/ContactOperationProcessor.java
index ab7c6f7..0a79197 100644
--- a/src/main/java/envoy/server/processors/ContactOperationProcessor.java
+++ b/src/main/java/envoy/server/processors/ContactOperationProcessor.java
@@ -5,9 +5,9 @@ import java.util.Arrays;
import envoy.data.Contacts;
import envoy.event.ContactOperationEvent;
-import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectWriteProxy;
/**
diff --git a/src/main/java/envoy/server/processors/ContactsRequestEventProcessor.java b/src/main/java/envoy/server/processors/ContactsRequestEventProcessor.java
index 5443211..fe003f4 100644
--- a/src/main/java/envoy/server/processors/ContactsRequestEventProcessor.java
+++ b/src/main/java/envoy/server/processors/ContactsRequestEventProcessor.java
@@ -6,10 +6,10 @@ import java.util.stream.Collectors;
import envoy.data.Contacts;
import envoy.event.ContactSearchRequest;
import envoy.event.ContactSearchResult;
-import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.data.User;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectWriteProxy;
/**
diff --git a/src/main/java/envoy/server/processors/LoginCredentialProcessor.java b/src/main/java/envoy/server/processors/LoginCredentialProcessor.java
index 00c4985..2e3b6e0 100644
--- a/src/main/java/envoy/server/processors/LoginCredentialProcessor.java
+++ b/src/main/java/envoy/server/processors/LoginCredentialProcessor.java
@@ -12,10 +12,10 @@ import envoy.data.Message.MessageStatus;
import envoy.data.User;
import envoy.data.User.UserStatus;
import envoy.event.HandshakeRejectionEvent;
-import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.data.Message;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectWriteProxy;
/**
diff --git a/src/main/java/envoy/server/processors/MessageProcessor.java b/src/main/java/envoy/server/processors/MessageProcessor.java
index 2b93336..a1e4f7c 100644
--- a/src/main/java/envoy/server/processors/MessageProcessor.java
+++ b/src/main/java/envoy/server/processors/MessageProcessor.java
@@ -5,9 +5,9 @@ import java.util.Date;
import envoy.data.Message;
import envoy.event.MessageStatusChangeEvent;
-import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectWriteProxy;
/**
diff --git a/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java b/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java
index 045f866..9949e43 100644
--- a/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java
+++ b/src/main/java/envoy/server/processors/MessageStatusChangeProcessor.java
@@ -5,9 +5,9 @@ import java.io.IOException;
import envoy.data.Message.MessageStatus;
import envoy.event.MessageStatusChangeEvent;
import envoy.exception.EnvoyException;
-import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectWriteProxy;
/**
diff --git a/src/main/java/envoy/server/processors/UserStatusChangeProcessor.java b/src/main/java/envoy/server/processors/UserStatusChangeProcessor.java
index d9ab89a..59f2ca3 100644
--- a/src/main/java/envoy/server/processors/UserStatusChangeProcessor.java
+++ b/src/main/java/envoy/server/processors/UserStatusChangeProcessor.java
@@ -4,10 +4,10 @@ import java.io.IOException;
import envoy.data.User.UserStatus;
import envoy.event.UserStatusChangeEvent;
-import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.data.User;
import envoy.server.database.PersistenceManager;
+import envoy.server.net.ConnectionManager;
import envoy.server.net.ObjectWriteProxy;
/**