Use an atomic integer for the connection count

Although channelOpen is called on the boss thread, channelClosed is
called on one of the IO threads.