Dennis Thrysøe
Dennis Thrysøe

Reputation: 1911

Spring Integration: BindException during test

I am using TcpNioServerConnectionFactory in some spring contexts being tested with JUnit and the spring test runner.

I sometimes get the following exception when running the tests.

java.net.BindException: Address already in use: bind

So it seems that the listening port is not unbound. Is there any way that I can ensure that the ports are unbound before moving to the next test?

The problem has only been observed on windows until now. So maybe it is related to windows being slower to actually unbind the port?

Upvotes: 0

Views: 486

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121427

Actually there is an issue with Windows and closing sockets.

We fixed it recently in Spring Integration 3.0: https://jira.springsource.org/browse/INT-3233

However you have to stop() ConnectionFactory in the end of tests anyway.

Upvotes: 1

Related Questions