use of org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl in project bgpcep by opendaylight.
the class BGPPeerAcceptorImplTest method testBGPPeerAcceptorImpl.
@Test
public void testBGPPeerAcceptorImpl() throws Exception {
final InetSocketAddress inetServerAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final IpAddressNoZone serverIpAddress = new IpAddressNoZone(new Ipv4AddressNoZone(InetSocketAddressUtil.toHostAndPort(inetServerAddress).getHost()));
final PortNumber portNumber = new PortNumber(Uint16.valueOf(InetSocketAddressUtil.toHostAndPort(inetServerAddress).getPort()));
this.registry.addPeer(serverIpAddress, this.serverListener, createPreferences(inetServerAddress));
final BGPPeerAcceptorImpl bgpPeerAcceptor = new BGPPeerAcceptorImpl(serverIpAddress, portNumber, this.serverDispatcher);
bgpPeerAcceptor.start();
final Future<BGPSessionImpl> futureClient = this.clientDispatcher.createClient(this.clientAddress, inetServerAddress, 2, true);
waitFutureSuccess(futureClient);
final BGPSessionImpl session = futureClient.get();
Assert.assertEquals(State.UP, this.clientListener.getState());
Assert.assertEquals(AS_NUMBER, session.getAsNumber());
Assert.assertEquals(Sets.newHashSet(IPV_4_TT), session.getAdvertisedTableTypes());
session.close();
checkIdleState(this.clientListener);
bgpPeerAcceptor.close();
}
Aggregations