I am searching for a Java library (or a simple class) that is able to manage server sessions for any protocol. My application is not related in any way to HTTP. The sessions have to stay alive between different connections, just like HTTP cookies do.
I guess the way to go is:
- client connects to server
- client sends the login informations
- server replies with a status and a session ID (a long string, just like JSESSIONID or PHPSESSID)
- client sends requests to server (with existing or new TCP connections), always providing the session ID
- client asks to logout
- server deletes the session and invalidates the session ID
I'm just looking for something existing regarding the session management part, even if it's really easy to implement. Otherwise I guess a Map
and a random string generator will do the job.