Buggy code:
final class RemoteOSGiServiceImpl implements RemoteOSGiService , Remoting { static int R_OSGI_PORT = 9278 ; static final String R_OSGi_PORT_PROPERTY = "ch.ethz.iks.r_osgi.port" ; static final String REGISTER_DEFAULT_TCP_CHANNEL = "ch.ethz.iks.r_osgi.registerDefaultChannel" ; static final String PROXY_DEBUG_PROPERTY = "ch.ethz.iks.r_osgi.debug.proxyGeneration" ; static final String MSG_DEBUG_PROPERTY = "ch.ethz.iks.r_osgi.debug.messages" ; static final String DEBUG_PROPERTY = "ch.ethz.iks.r_osgi.debug.internal" ; static final String R_OSGi_INTERNAL = "internal" ; static boolean PROXY_DEBUG ; static boolean MSG_DEBUG ; static boolean DEBUG ; static String MY_ADDRESS ; private static Map serviceRegistrations = new HashMap ( 1 ) ; private static short nextXid ; static LogService log ; static ServiceTracker eventAdminTracker ; private static ServiceTracker eventHandlerTracker ; private static ServiceTracker remoteServiceTracker ; private static ServiceTracker remoteServiceListenerTracker ; private static ServiceTracker networkChannelFactoryTracker ; private static ServiceTracker serviceDiscoveryHandlerTracker ; private static Map channels = new HashMap ( 0 ) ; private static Map multiplexers = new HashMap ( 0 ) ; RemoteOSGiServiceImpl ( ) throws IOException { } private void setupTrackers ( ) throws IOException { } public RemoteServiceReference [ ] connect ( final URI uri ) throws RemoteOSGiException { } public void disconnect ( final URI endpoint ) throws RemoteOSGiException { } public RemoteServiceReference getRemoteServiceReference ( final URI serviceURI ) { } public RemoteServiceReference [ ] getRemoteServiceReferences ( final URI service , final String clazz , final Filter filter ) { } public Object getRemoteService ( final RemoteServiceReference ref ) { } private ServiceReference getFetchedServiceReference ( final RemoteServiceReference ref ) { } private void fetchService ( final RemoteServiceReference ref ) throws RemoteOSGiException { } static ChannelEndpoint getChannel ( final URI uri ) { } public ChannelEndpoint getEndpoint ( final String uri ) { } public ChannelEndpointManager getEndpointManager ( final URI remoteEndpointAddress ) { } private ChannelEndpointMultiplexer getMultiplexer ( final String uri ) { } private static String getChannelURI ( URI serviceURI ) { <START_BUG> return URI . create ( ( ( ( ( ( serviceURI . getScheme ( ) ) + ":////" ) + ( serviceURI . getHostName ( ) ) ) + ":" ) + ( serviceURI . getPort ( ) ) ) ) . toString ( ) ; <END_BUG> } void cleanup ( ) { } static RemoteServiceRegistration [ ] getServices ( ) { } static RemoteServiceRegistration getServiceRegistration ( final String serviceID ) { } static String [ ] getTopics ( ) { } static synchronized short nextXid ( ) { } static void registerChannelEndpoint ( final ChannelEndpoint channel ) { } static void unregisterChannelEndpoint ( final String channelURI ) { } static void updateLeases ( final LeaseUpdateMessage msg ) { } static void notifyRemoteServiceListeners ( final RemoteServiceEvent event ) { } private static void match ( final ServiceReference ref , final RemoteServiceEvent event ) { } private void registerWithServiceDiscovery ( final RemoteServiceRegistration reg ) { } private void unregisterFromServiceDiscovery ( final RemoteServiceRegistration reg ) { } public void createEndpoint ( final NetworkChannel channel ) { } public void ungetRemoteService ( RemoteServiceReference remoteServiceReference ) { } }

Fix:
return URI . create ( ( ( ( ( ( serviceURI . getScheme ( ) ) + ":////" ) + ( serviceURI . getHost ( ) ) ) + ":" ) + ( serviceURI . getPort ( ) ) ) ) . toString ( ) ;