This sounds like it is related to this issue, which is fixed but we need to do a release of 1.0.3, or you can build from SVN in the mean time.
while running apache ds embedded in an unit test szenario i run into the problem that after shutdown the server socket is not
released/closed. The next unittest which tries to startup the directory server from scratch breaks down because of an "adress
already in use exception".
I used the sample code to start/shudown from
Apache DS 1.0.2