import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.util.concurrent.Future;
import java.net.InetSocketAddress;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
protected StrictBGPPeerRegistry serverRegistry;
protected CodecsRegistryImpl codecsRegistry;
+ private List<BGPDispatcherImpl> clientDispatchers;
+
@Override
@Before
public void setUp() throws Exception {
this.codecsRegistry = CodecsRegistryImpl.create(this.mappingService.getCodecFactory(),
this.ribExtension.getClassLoadingStrategy());
+ this.clientDispatchers = new ArrayList<>();
}
@Override
this.ribActivator.close();
this.inetActivator.close();
this.bgpActivator.close();
+ this.clientDispatchers.forEach(BGPDispatcherImpl::close);
+ this.clientDispatchers = null;
super.tearDown();
}
final StrictBGPPeerRegistry clientRegistry = new StrictBGPPeerRegistry();
final BGPDispatcherImpl clientDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss,
this.worker, clientRegistry);
+
+ clientDispatchers.add(clientDispatcher);
clientRegistry.addPeer(new IpAddress(new Ipv4Address(RIB_ID)), sessionListener,
new BGPSessionPreferences(remoteAsNumber, HOLDTIMER, new BgpId(peer),
AS_NUMBER, Lists.newArrayList(bgpParameters)));