1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.testsuite.svm;
17
18 import io.netty.channel.ChannelInitializer;
19 import io.netty.channel.ChannelPipeline;
20 import io.netty.channel.socket.SocketChannel;
21 import io.netty.handler.codec.http.HttpServerCodec;
22 import io.netty.handler.codec.http.HttpServerExpectContinueHandler;
23
24 import java.util.concurrent.CompletableFuture;
25
26 public class HttpNativeServerInitializer extends ChannelInitializer<SocketChannel> {
27
28 private final CompletableFuture<Void> httpRequestFuture;
29
30 public HttpNativeServerInitializer(CompletableFuture<Void> httpRequestFuture) {
31 this.httpRequestFuture = httpRequestFuture;
32 }
33
34 @Override
35 public void initChannel(SocketChannel ch) {
36 ChannelPipeline p = ch.pipeline();
37 p.addLast(new HttpServerCodec());
38 p.addLast(new HttpServerExpectContinueHandler());
39 p.addLast(new HttpNativeServerHandler(httpRequestFuture));
40 }
41 }