Skip to content

Commit f798501

Browse files
author
jiangwenping
committed
增加http解析
1 parent 06c8510 commit f798501

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

game-core/src/test/java/com/snowcattle/game/net/client/http/GameHttpClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static void main(String[] args) throws Exception {
5858
Bootstrap b = new Bootstrap();
5959
b.group(group)
6060
.channel(NioSocketChannel.class)
61-
.handler(new HttpSnoopClientInitializer(sslCtx));
61+
.handler(new GameHttpClientInitializer(sslCtx));
6262

6363
// Make the connection attempt.
6464
Channel ch = b.connect(host, port).sync().channel();

game-core/src/test/java/com/snowcattle/game/net/client/http/GameHttpClientHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
* Created by jiangwenping on 2017/9/29.
1616
*/
1717

18-
public class GameHttpClientHandler extends SimpleChannelInboundHandler<HttpObject> {
18+
public class GameHttpClientHandler extends SimpleChannelInboundHandler<Object> {
1919

2020
@Override
21-
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
21+
public void channelRead0(ChannelHandlerContext ctx, Object msg) {
2222
if (msg instanceof HttpResponse) {
2323
HttpResponse response = (HttpResponse) msg;
2424

game-core/src/test/java/com/snowcattle/game/net/client/http/GameHttpClientInitializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public void initChannel(SocketChannel ch) {
3535
// Uncomment the following line if you don't want to handle HttpContents.
3636
//p.addLast(new HttpObjectAggregator(1048576));
3737

38-
p.addLast("encoder", new HttpResponseEncoder());
38+
p.addLast("encoder", new HttpRequestEncoder());
3939
// p.addLast("trunk", new HttpObjectAggregator(1048576));
40-
p.addLast("decoder", new HttpRequestDecoder());
40+
p.addLast("decoder", new HttpResponseDecoder());
4141

4242
p.addLast(new GameHttpClientHandler());
4343
}

0 commit comments

Comments
 (0)