use of org.jboss.netty.handler.codec.http.HttpResponseDecoder in project sockjs-netty by cgbystrom.
the class SockJsClient method newClient.
public static SockJsClient newClient(URI url, Protocol protocol, final SessionCallback callback) {
ClientBootstrap bootstrap = new ClientBootstrap(socketChannelFactory);
switch(protocol) {
case WEBSOCKET:
final WebSocketClient clientHandler = new WebSocketClient(bootstrap, url, callback);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("decoder", new HttpResponseDecoder());
pipeline.addLast("encoder", new HttpRequestEncoder());
pipeline.addLast("ws-handler", clientHandler);
return pipeline;
}
});
return clientHandler;
}
throw new IllegalArgumentException("Invalid protocol specified");
}
use of org.jboss.netty.handler.codec.http.HttpResponseDecoder in project sockjs-netty by cgbystrom.
the class SockJsClient method newLocalClient.
public static SockJsClient newLocalClient(URI url, Protocol protocol, final SessionCallback callback) {
ClientBootstrap bootstrap = new ClientBootstrap(localSocketChannelFactory);
switch(protocol) {
case WEBSOCKET:
final WebSocketClient clientHandler = new WebSocketClient(bootstrap, url, callback);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("decoder", new HttpResponseDecoder());
pipeline.addLast("encoder", new HttpRequestEncoder());
pipeline.addLast("ws-handler", clientHandler);
return pipeline;
}
});
return clientHandler;
}
throw new IllegalArgumentException("Invalid protocol specified");
}
use of org.jboss.netty.handler.codec.http.HttpResponseDecoder in project cdap by caskdata.
the class ClientChannelPipelineFactory method getPipeline.
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("tracker", connectionTracker);
pipeline.addLast("request-encoder", new HttpRequestEncoder());
// outbound handler gets dynamically added here (after 'request-encoder')
pipeline.addLast("response-decoder", new HttpResponseDecoder());
// disable the read-specific and write-specific timeouts; we only utilize IdleState#ALL_IDLE
pipeline.addLast("idle-event-generator", new IdleStateHandler(timer, 0, 0, connectionTimeout));
pipeline.addLast("idle-event-processor", new IdleEventProcessor());
return pipeline;
}
Aggregations