GeezerVison is showing github.com — Finish the refactoring of bootstrap · netty/netty@ec1339d
File treeExpand file treeCollapse file tree Open diff view settings example/src/main/java/io/netty/example testsuite/src/test/java/io/netty/testsuite/transport/socket transport/src/main/java/io/netty/bootstrap
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/discard/DiscardClient.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | */ | 16 | 16 | package io.netty.example.discard; | 17 | 17 |
| 18 | | -import io.netty.bootstrap.Bootstrap; | | 18 | +import io.netty.bootstrap.ClientBootstrap; | 19 | 19 | import io.netty.channel.ChannelFuture; | 20 | 20 | import io.netty.channel.socket.nio.NioEventLoopGroup; | 21 | 21 | import io.netty.channel.socket.nio.NioSocketChannel; | @@ -36,10 +36,10 @@ public DiscardClient(String host, int port, int firstMessageSize) { | 36 | 36 | } | 37 | 37 |
| 38 | 38 | public void run() throws Exception { | 39 | | - Bootstrap b = new Bootstrap(); | | 39 | + ClientBootstrap b = new ClientBootstrap(); | 40 | 40 | try { | 41 | 41 | b.group(new NioEventLoopGroup()) | 42 | | - .channel(new NioSocketChannel()) | | 42 | + .channel(NioSocketChannel.class) | 43 | 43 | .remoteAddress(host, port) | 44 | 44 | .handler(new DiscardClientHandler(firstMessageSize)); | 45 | 45 |
| |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/discard/DiscardServer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -37,7 +37,7 @@ public void run() throws Exception { | 37 | 37 | ServerBootstrap b = new ServerBootstrap(); | 38 | 38 | try { | 39 | 39 | b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) | 40 | | - .channel(new NioServerSocketChannel()) | | 40 | + .channel(NioServerSocketChannel.class) | 41 | 41 | .localAddress(port) | 42 | 42 | .childHandler(new ChannelInitializer<SocketChannel>() { | 43 | 43 | @Override | |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/echo/EchoClient.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | */ | 16 | 16 | package io.netty.example.echo; | 17 | 17 |
| 18 | | -import io.netty.bootstrap.Bootstrap; | | 18 | +import io.netty.bootstrap.ClientBootstrap; | 19 | 19 | import io.netty.channel.ChannelFuture; | 20 | 20 | import io.netty.channel.ChannelInitializer; | 21 | 21 | import io.netty.channel.ChannelOption; | @@ -47,10 +47,10 @@ public EchoClient(String host, int port, int firstMessageSize) { | 47 | 47 |
| 48 | 48 | public void run() throws Exception { | 49 | 49 | // Configure the client. | 50 | | - Bootstrap b = new Bootstrap(); | | 50 | + ClientBootstrap b = new ClientBootstrap(); | 51 | 51 | try { | 52 | 52 | b.group(new NioEventLoopGroup()) | 53 | | - .channel(new NioSocketChannel()) | | 53 | + .channel(NioSocketChannel.class) | 54 | 54 | .option(ChannelOption.TCP_NODELAY, true) | 55 | 55 | .remoteAddress(new InetSocketAddress(host, port)) | 56 | 56 | .handler(new ChannelInitializer<SocketChannel>() { | |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/echo/EchoServer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ public void run() throws Exception { | 43 | 43 | ServerBootstrap b = new ServerBootstrap(); | 44 | 44 | try { | 45 | 45 | b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) | 46 | | - .channel(new NioServerSocketChannel()) | | 46 | + .channel(NioServerSocketChannel.class) | 47 | 47 | .option(ChannelOption.SO_BACKLOG, 100) | 48 | 48 | .localAddress(new InetSocketAddress(port)) | 49 | 49 | .childOption(ChannelOption.TCP_NODELAY, true) | |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/factorial/FactorialClient.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | */ | 16 | 16 | package io.netty.example.factorial; | 17 | 17 |
| 18 | | -import io.netty.bootstrap.Bootstrap; | | 18 | +import io.netty.bootstrap.ClientBootstrap; | 19 | 19 | import io.netty.channel.ChannelFuture; | 20 | 20 | import io.netty.channel.socket.nio.NioEventLoopGroup; | 21 | 21 | import io.netty.channel.socket.nio.NioSocketChannel; | @@ -37,10 +37,10 @@ public FactorialClient(String host, int port, int count) { | 37 | 37 | } | 38 | 38 |
| 39 | 39 | public void run() throws Exception { | 40 | | - Bootstrap b = new Bootstrap(); | | 40 | + ClientBootstrap b = new ClientBootstrap(); | 41 | 41 | try { | 42 | 42 | b.group(new NioEventLoopGroup()) | 43 | | - .channel(new NioSocketChannel()) | | 43 | + .channel(NioSocketChannel.class) | 44 | 44 | .remoteAddress(host, port) | 45 | 45 | .handler(new FactorialClientInitializer(count)); | 46 | 46 |
| |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/factorial/FactorialServer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,7 @@ public void run() throws Exception { | 35 | 35 | ServerBootstrap b = new ServerBootstrap(); | 36 | 36 | try { | 37 | 37 | b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) | 38 | | - .channel(new NioServerSocketChannel()) | | 38 | + .channel(NioServerSocketChannel.class) | 39 | 39 | .localAddress(port) | 40 | 40 | .childHandler(new FactorialServerInitializer()); | 41 | 41 |
| |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/http/file/HttpStaticFileServer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,7 +31,7 @@ public void run() throws Exception { | 31 | 31 | ServerBootstrap b = new ServerBootstrap(); | 32 | 32 | try { | 33 | 33 | b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) | 34 | | - .channel(new NioServerSocketChannel()) | | 34 | + .channel(NioServerSocketChannel.class) | 35 | 35 | .localAddress(port) | 36 | 36 | .childHandler(new HttpStaticFileServerInitializer()); | 37 | 37 |
| |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/http/snoop/HttpSnoopClient.java +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 | */ | 16 | 16 | package io.netty.example.http.snoop; | 17 | 17 |
| 18 | | -import io.netty.bootstrap.Bootstrap; | | 18 | +import io.netty.bootstrap.ClientBootstrap; | 19 | 19 | import io.netty.channel.Channel; | 20 | 20 | import io.netty.channel.socket.nio.NioEventLoopGroup; | 21 | 21 | import io.netty.channel.socket.nio.NioSocketChannel; | @@ -62,10 +62,10 @@ public void run() throws Exception { | 62 | 62 | boolean ssl = scheme.equalsIgnoreCase("https"); | 63 | 63 |
| 64 | 64 | // Configure the client. | 65 | | - Bootstrap b = new Bootstrap(); | | 65 | + ClientBootstrap b = new ClientBootstrap(); | 66 | 66 | try { | 67 | 67 | b.group(new NioEventLoopGroup()) | 68 | | - .channel(new NioSocketChannel()) | | 68 | + .channel(NioSocketChannel.class) | 69 | 69 | .handler(new HttpSnoopClientInitializer(ssl)) | 70 | 70 | .remoteAddress(new InetSocketAddress(host, port)); | 71 | 71 |
| |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/http/snoop/HttpSnoopServer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,7 @@ public void run() throws Exception { | 40 | 40 |
| 41 | 41 | try { | 42 | 42 | b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) | 43 | | - .channel(new NioServerSocketChannel()) | | 43 | + .channel(NioServerSocketChannel.class) | 44 | 44 | .childHandler(new HttpSnoopServerInitializer()) | 45 | 45 | .localAddress(new InetSocketAddress(port)); | 46 | 46 |
| |
Collapse file Copy file name to clipboardExpand all lines: example/src/main/java/io/netty/example/http/websocketx/autobahn/AutobahnServer.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -36,7 +36,7 @@ public void run() throws Exception { | 36 | 36 | ServerBootstrap b = new ServerBootstrap(); | 37 | 37 | try { | 38 | 38 | b.group(new NioEventLoopGroup(), new NioEventLoopGroup()) | 39 | | - .channel(new NioServerSocketChannel()) | | 39 | + .channel(NioServerSocketChannel.class) | 40 | 40 | .localAddress(port) | 41 | 41 | .childHandler(new AutobahnServerInitializer()); | 42 | 42 |
| |
|