synchronized static public TransportServer bind(String location) throws URISyntaxException, IOException { if (servers.containsKey(location)) { throw new IOException("Server already bound: " + location); } PipeTransportServer server = new PipeTransportServer(); server.setConnectURI(location); server.setName(location); servers.put(location, server); return server; }
synchronized static public void unbind(PipeTransportServer server) { servers.remove(server.getName()); } }
public PipeTransport connect() { int connectionId = connectionCounter.incrementAndGet(); String remoteAddress = connectURI.toString() + "#" + connectionId; assert this.listener != null : "Server does not have an accept listener"; PipeTransport clientTransport = createClientTransport(); PipeTransport serverTransport = createServerTransport(); clientTransport.peer = serverTransport; serverTransport.peer = clientTransport; clientTransport.setRemoteAddress(remoteAddress); serverTransport.setRemoteAddress(remoteAddress); serverTransport.setMarshal(marshal); this.acceptSource.merge(serverTransport); return clientTransport; }
@Deprecated public void start(Runnable onCompleted) throws Exception { start(new TaskWrapper(onCompleted)); } @Deprecated
synchronized static public Transport connect(String location) throws IOException, URISyntaxException { PipeTransportServer server = lookup(location); if (server == null) { throw new IOException("Server is not bound: " + location); } return server.connect(); }
@Deprecated public void stop(Runnable onCompleted) throws Exception { stop(new TaskWrapper(onCompleted)); }