Sorry, I didn't make the question clear. As the title said, it is possible to leak; but actually, it is not

. I have checked all the connection handling and cannot find anything wrong with it. After using yourkit tool (it allows to check the heap space continuously with the force GC running function), it turned out that because we are using
thread in order to run that function, the heap space keeps increasing so fast but the GC cannot run fast enough to free the unused memory. So, what I did is trying to clear the session when possible (after each thread) and the most important thing is using this
suggestion. The
test case passed even with the 64 MB.
Thank for your time