Example usage for org.springframework.util SocketUtils findAvailableTcpPort

List of usage examples for org.springframework.util SocketUtils findAvailableTcpPort

Introduction

In this page you can find the example usage for org.springframework.util SocketUtils findAvailableTcpPort.

Prototype

public static int findAvailableTcpPort(int minPort) 

Source Link

Document

Find an available TCP port randomly selected from the range [ minPort , #PORT_RANGE_MAX ].

Usage

From source file:org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandlerIntegrationTests.java

@Before
public void setUp() throws Exception {
    logger.debug("Setting up before '" + this.testName.getMethodName() + "'");
    this.port = SocketUtils.findAvailableTcpPort(61613);
    this.responseChannel = new ExecutorSubscribableChannel();
    this.responseHandler = new TestMessageHandler();
    this.responseChannel.subscribe(this.responseHandler);
    this.eventPublisher = new TestEventPublisher();
    startActiveMqBroker();/*from  w  w  w.j  a  v a  2 s.c o  m*/
    createAndStartRelay();
}