2011-10-17 15:12:37 +11:00
|
|
|
/*
|
2012-06-04 13:31:44 -07:00
|
|
|
* Copyright 2012 The Netty Project
|
2011-10-17 15:12:37 +11:00
|
|
|
*
|
2011-12-09 14:18:34 +09:00
|
|
|
* The Netty Project licenses this file to you under the Apache License,
|
|
|
|
* version 2.0 (the "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at:
|
2011-10-17 15:12:37 +11:00
|
|
|
*
|
2020-10-23 14:44:18 +02:00
|
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
2011-10-17 15:12:37 +11:00
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
2011-12-09 14:18:34 +09:00
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
2011-10-17 15:12:37 +11:00
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2017-02-20 14:06:48 +01:00
|
|
|
package io.netty.testsuite.autobahn;
|
2011-10-17 15:12:37 +11:00
|
|
|
|
2012-05-29 16:41:26 -07:00
|
|
|
import io.netty.channel.ChannelInitializer;
|
2011-12-09 12:38:59 +09:00
|
|
|
import io.netty.channel.ChannelPipeline;
|
2012-05-29 16:41:26 -07:00
|
|
|
import io.netty.channel.socket.SocketChannel;
|
2011-12-09 12:38:59 +09:00
|
|
|
import io.netty.handler.codec.http.HttpRequestDecoder;
|
|
|
|
import io.netty.handler.codec.http.HttpResponseEncoder;
|
2011-10-17 15:12:37 +11:00
|
|
|
|
2012-05-29 16:41:26 -07:00
|
|
|
public class AutobahnServerInitializer extends ChannelInitializer<SocketChannel> {
|
2011-12-15 22:25:40 +11:00
|
|
|
@Override
|
2012-05-29 16:41:26 -07:00
|
|
|
public void initChannel(SocketChannel ch) throws Exception {
|
|
|
|
ChannelPipeline pipeline = ch.pipeline();
|
2014-03-05 06:56:21 +01:00
|
|
|
pipeline.addLast("encoder", new HttpResponseEncoder());
|
2011-12-15 22:25:40 +11:00
|
|
|
pipeline.addLast("decoder", new HttpRequestDecoder());
|
2012-01-15 00:17:10 +09:00
|
|
|
pipeline.addLast("handler", new AutobahnServerHandler());
|
2011-12-15 22:25:40 +11:00
|
|
|
}
|
2011-10-17 15:12:37 +11:00
|
|
|
}
|