import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
+import org.opendaylight.protocol.util.InetSocketAddressUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open;
public class AbstractPCEPSessionTest {
- protected static final String IP_ADDRESS = "127.0.0.1";
protected static final short KEEP_ALIVE = 15;
protected static final short DEADTIMER = 40;
@Mock
private SocketAddress address;
+ protected final String ipAddress = InetSocketAddressUtil.getRandomLoopbackIpAddress();
+ protected final int port = InetSocketAddressUtil.getRandomPort();
protected final List<Notification> msgsSend = Lists.newArrayList();
protected Open openMsg;
doReturn(this.pipeline).when(this.pipeline).addFirst(any(ChannelHandler.class));
doReturn(true).when(this.channel).isActive();
doReturn(mock(ChannelFuture.class)).when(this.channel).close();
- doReturn(new InetSocketAddress(IP_ADDRESS, 4189)).when(this.channel).remoteAddress();
- doReturn(new InetSocketAddress(IP_ADDRESS, 4189)).when(this.channel).localAddress();
+ doReturn(new InetSocketAddress(ipAddress, port)).when(this.channel).remoteAddress();
+ doReturn(new InetSocketAddress(ipAddress, port)).when(this.channel).localAddress();
this.openMsg = new OpenBuilder().setOpenMessage(
new OpenMessageBuilder().setOpen(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder().setDeadTimer(