MgcpEndpointManager implements MgcpEndpointObserver, MgcpMessageObserver, MgcpMessageSubject { public void uninstallProvider(String namespace) { MgcpEndpointProvider<?> provider = this.providers.remove(namespace); if(provider != null) { if (log.isInfoEnabled()) { log.info("Uninstalled MGCP Endpoint Provider for namespace " + provider.getNamespace()); } } } MgcpEndpointManager(); void installProvider(MgcpEndpointProvider<?> provider); void uninstallProvider(String namespace); boolean supportsNamespace(String namespace); MgcpEndpoint registerEndpoint(String namespace); MgcpEndpoint getEndpoint(String endpointId); void unregisterEndpoint(String endpointId); @Override void onMessage(InetSocketAddress from, InetSocketAddress to, MgcpMessage message, MessageDirection direction); @Override void observe(MgcpMessageObserver observer); @Override void forget(MgcpMessageObserver observer); @Override void notify(Object originator, InetSocketAddress from, InetSocketAddress to, MgcpMessage message, MessageDirection direction); @Override void onEndpointStateChanged(MgcpEndpoint endpoint, MgcpEndpointState state);  }
@Test public void testUninstallProvider() { MgcpEndpointManager endpointManager = new MgcpEndpointManager(); AbstractMgcpEndpointProvider<?> bridgeProvider = mock(AbstractMgcpEndpointProvider.class); AbstractMgcpEndpointProvider<?> ivrProvider = mock(AbstractMgcpEndpointProvider.class); when(bridgeProvider.getNamespace()).thenReturn(NAMESPACE_BRIDGE); when(ivrProvider.getNamespace()).thenReturn(NAMESPACE_IVR); endpointManager.installProvider(bridgeProvider); endpointManager.installProvider(ivrProvider); endpointManager.uninstallProvider(NAMESPACE_IVR); assertTrue(endpointManager.supportsNamespace(NAMESPACE_BRIDGE)); assertFalse(endpointManager.supportsNamespace(NAMESPACE_IVR)); }