use of org.jboss.netty.channel.local.LocalClientChannelFactory in project sockjs-netty by cgbystrom.
the class WebSocketClient method connect.
@Override
public ChannelFuture connect() throws URISyntaxException {
this.sessionId = UUID.randomUUID().toString();
URI sockJsUri = new URI("http", uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath() + "/999/" + sessionId + "/websocket", uri.getQuery(), uri.getFragment());
this.wsHandshaker = new WebSocketClientHandshakerFactory().newHandshaker(sockJsUri, WebSocketVersion.V13, null, false, null);
if (bootstrap.getFactory() instanceof LocalClientChannelFactory) {
return bootstrap.connect(new LocalAddress(getPort(uri)));
} else {
return bootstrap.connect(new InetSocketAddress(uri.getHost(), getPort(uri)));
}
}
Aggregations