The IO Connector Service is implemented as described in the OSGi Service Platform Specification Release 6. In addition, it possesses capabilities to dynamically detect new connection factory services registered with the framework.
Overview
The communication API of OSGi is defined for all bundles that require connectivity to external computers or devices. It uses the J2ME Connection Framework, represented by the javax.microedition.io API. This model is based on a Connector class which manages many different connection implementers.
The OSGi Communication API replaces the javax.microedition.io.Connector class from J2ME with its own ConnectorService interface (org.osgi.service.io.ConnectorService) available as a service in the framework. This is necessary for the needs of the OSGi Service Framework model. The OSGi IO Connector Service manages the available connection implementations and creates connections requested by bundles. Services which need to create connections must use the IO Connector Service. They need NOT work directly with the connection implementers.
The communication implementations are registered as services called "connection factories". They are represented by the org.osgi.service.io.ConnectionFactory interface. Each connection factory declares the types of connections it implements by registering for a particular scheme. A scheme is the protocol or pattern of communication implemented. A bundle which demands a connection must pass to the IO Connector Service a valid Uniform Resource Identifier (URI) starting with the expected scheme. The scheme is the part of the URI before the first ":". When the IO Connector Service receives the URI, it parses it and then redirects the URI to the appropriate connection factory.
Each bundle that needs to communicate must invoke some of the open methods of the IO Connector Service. The connection factory found by the Connector Service will create a javax.microedition.io.Connection object.
Figure 1. The connection-requester bundle uses the IO Connector Service to make the appropriate connection factory create the desired connection.

Registering Bundle
The service is registered by OSGi Connector Bundle.
How the IO Connector Service Creates Connections
When the open method of the IO Connector Service is invoked by some bundle needing a connection, there are two possibilities:
This pattern is visualized in the following figure.

The IO Connector Service creates each connection by invoking the connection factory's createConnection method. Before the connection is initiated, the Connector Service parses the requested URI and then places its components into a Dictionary, so that the ConnectionFactory will be able to get only the components it needs.
A connection has three modes: read, write and read&write. They are defined as constants in the ConnectorService interface and can be passed as a parameter to the open method. If no mode is passed, the read&write mode is implied.
You can obtain a normal java.io stream instead of a javax.microedition.io.Connection by using the openOutputStream / openDataOutputStream methods.
If the connection factory or the Connector Service gets unregistered, the connection factory's close() method is invoked to withdraw all connections currently available in the connection factory.
Connection Types
The generic connection interface obtained through the IO Connector Service is javax.microedition.io.Connection. However, this interface is not convenient to use because it contains only one method: the close() method. The open method is not defined here because the opening of a connection is always handled by the IO Connector Service.
The javax.microedition.io package contains a set of much more convenient connections extending the generic interface. The following figure shows the connection hierarchy in the package.

Most connection factories created in the OSGi runtime return not the generic connection itself but some of its inheritance. They contain useful methods allowing you to send and/or receive data through input/output streams or datagram packets. Refer to each connection factory's description in Overview above for details about the connection types supported by it.
Composing URIs
The format of the URI must be composed according to RFC 2396 (Uniform Resource Identifiers (URI): Generic Syntax). Usually, the form of a URI is: <scheme>:<target>[<params>], where parts enclosed in [..] are optional. For example:
socket://127.0.0.1:1449
sms://+46705950899