I configured an Apache FtpServer as follows:
@Component
public class FtpDummyServer {
private FtpServer server;
@PostConstruct
public void init() throws FtpException {
..some initialization
this.server = serverFactory.createServer();
this.server.start();
}
@PreDestroy
public void stop() {
this.server.stop();
}
Notice that the server is automatically started in the @PostConstruct. I have different tests configured in SpringBoot as follows:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MainApplication.class)
@WebIntegrationTest
public class ApplicationTestX {
...
}
When I run the tests individually, they succeed. However, when I run them together, I get a java.net.BindException: Address already in use: bind
. How can I avoid that?