PacketReader creates 2 threads in the constructor with a static name so the name will be the same if we have many readers for many connections.
PacketWriter creats 3 threads in the constructor. Two of them have a static name whilst the last thread has no name.
Notify this thread when done:
When creating the threads, we don't yet have the username of the user that's logging in. We also don't have the connection ID from the server. Therefore, I created a new connection counter in XMPPConnection. All threads that get created then use a unique ID for the connection. Nice things about this value:
You can easily tell which threads are older than others by looking at the number.
The number stays consistent between connects and disconnects to the server (this could be a good or bad thing).