Description
`PooledConnectionFactory.createConnection(String userName, String password)` can return broken Connection. By `broken` I mean PooledConnection with referenceCount==1, but without underlying ActiveMQConnection.
The problem is in lines
connection = connectionsPool.borrowObject(key); ... return new PooledConnection(connection);
While method `borrowObject` validates the connection and `new PooledConnection` increments referenceCount, it's possible that some thread calls `ConnectionPool.decrementReferenceCount()` just between `borrowObject` and `new PooledConnection`. referenceCount at this stage can be a zero and the ConnectionPool became closed just prior to `new PooledConnection`.