public static abstract class Client {
protected abstract boolean run(XBridge bridge) throws Throwable;
protected final XBridge getBridge() throws com.sun.star.uno.Exception {
XConnector connector = Connector.create(context);
XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
XBridgeFactory.class,
context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
System.out.println("Client: Connecting...");
XConnection connection = connector.connect(connectionDescription);
System.out.println("Client: ...connected...");
XBridge bridge = factory.createBridge(
"", protocolDescription, connection, null);
System.out.println("Client: ...bridged.");
return bridge;