Buggy code:
final class R_OSGiRemoteServiceContainer implements IContainer , IRemoteServiceContainerAdapter , RemoteServiceListener { private BundleContext context ; private RemoteOSGiService remoteService ; private ChannelEndpointManager endpointMgr ; private final List containerListeners = new ArrayList ( 0 ) ; R_OSGiID containerID ; private R_OSGiID connectedID ; private ServiceTracker remoteServicesTracker ; private Map remoteServicesRegs = new HashMap ( 0 ) ; private Map remoteServiceListeners = new HashMap ( 0 ) ; public R_OSGiRemoteServiceContainer ( ) throws IDCreateException { } public R_OSGiRemoteServiceContainer ( final ID containerID ) throws IDCreateException { } private void startRegTracker ( ) { } public void addRemoteServiceListener ( final IRemoteServiceListener listener ) { } public IRemoteService getRemoteService ( final IRemoteServiceReference reference ) { } public IRemoteServiceReference [ ] getRemoteServiceReferences ( final ID [ ] idFilter , final String clazz , final String filter ) throws InvalidSyntaxException { } public IRemoteServiceRegistration registerRemoteService ( final String [ ] clazzes , final Object service , final Dictionary properties ) { } public void removeRemoteServiceListener ( final IRemoteServiceListener listener ) { } public boolean ungetRemoteService ( IRemoteServiceReference reference ) { } public Object getAdapter ( final Class adapter ) { } public void addListener ( final IContainerListener listener ) { } public void connect ( final ID targetID , final IConnectContext connectContext ) throws ContainerConnectException { Assert . isNotNull ( targetID ) ; if ( ( containerID ) != null ) { throw new ContainerConnectException ( ( "Container<seq2seq4repair_space>is<seq2seq4repair_space>already<seq2seq4repair_space>connected<seq2seq4repair_space>to<seq2seq4repair_space>" + ( containerID ) ) ) ; } final R_OSGiID target ; try { if ( targetID instanceof StringID ) { target = new R_OSGiID ( ( ( StringID ) ( targetID ) ) . getName ( ) ) ; } else if ( targetID instanceof R_OSGiID ) { target = ( ( R_OSGiID ) ( targetID ) ) ; } else { throw new ContainerConnectException ( ( "Incompatible<seq2seq4repair_space>target<seq2seq4repair_space>id<seq2seq4repair_space>" + targetID ) ) ; } fireListeners ( new ContainerConnectingEvent ( containerID , connectedID ) ) ; final RemoteServiceReference [ ] refs = remoteService . connect ( target . getURI ( ) ) ; if ( refs != null ) { for ( int i = 0 ; i < ( refs . length ) ; i ++ ) { checkImport ( refs [ i ] ) ; } } connectedID = target ; endpointMgr = remoteService . getEndpointManager ( target . getURI ( ) ) ; <START_BUG> containerID = ( ( R_OSGiID ) ( IDFactory . getDefault ( ) . createID ( "r-osgi" , endpointMgr . getLocalAddress ( ) . toString ( ) ) ) ) ; <END_BUG> startRegTracker ( ) ; } catch ( IOException ioe ) { throw new ContainerConnectException ( ioe ) ; } catch ( IDCreateException e ) { throw new ContainerConnectException ( e ) ; } fireListeners ( new ContainerConnectedEvent ( containerID , connectedID ) ) ; } public void disconnect ( ) { } public void dispose ( ) { } public Namespace getConnectNamespace ( ) { } public ID getConnectedID ( ) { } public void removeListener ( final IContainerListener listener ) { } public ID getID ( ) { } private void fireListeners ( final IContainerEvent event ) { } public void remoteServiceEvent ( final RemoteServiceEvent event ) { } private void checkImport ( final RemoteServiceReference ref ) { } private Hashtable clone ( final Dictionary props ) { } }

Fix:
containerID = ( ( R_OSGiID ) ( IDFactory . getDefault ( ) . createID ( NAME , endpointMgr . getLocalAddress ( ) . toString ( ) ) ) ) ;