address = new InetSocketAddress(bindURI.getPort());
} else {
address = new InetSocketAddress(bindURI.getHost(), bindURI.getPort());
}
AsyncServerSocketChannel serverSocketChannel = AsyncServerSocketChannel.open();
serverSocketChannel.socket().bind(address,backlog);
URI connectURI = bindURI;
try {
connectURI = URISupport.changeHost(connectURI, InetAddress.getLocalHost().getHostName());
connectURI = URISupport.changePort(connectURI, serverSocketChannel.socket().getLocalPort());
} catch (URISyntaxException e) {
throw (IOException)new IOException("Could not build connect URI: "+e).initCause(e);
}
return SynchToAsynchChannelServerAdapter.adapt(