diff --git a/net/pom.xml b/net/pom.xml
index 45a1ae06..88a0aaf5 100644
--- a/net/pom.xml
+++ b/net/pom.xml
@@ -134,6 +134,19 @@
${netty.version}
+
+
+ com.baidu
+ jprotobuf
+ ${jprotobuf.version}
+
+
+ slf4j-api
+ org.slf4j
+
+
+
+
org.javassist
diff --git a/net/src/main/java/com/zfoo/net/core/jprotobuf/JProtobufTcpClient.java b/net/src/main/java/com/zfoo/net/core/jprotobuf/JProtobufTcpClient.java
new file mode 100644
index 00000000..18dec41b
--- /dev/null
+++ b/net/src/main/java/com/zfoo/net/core/jprotobuf/JProtobufTcpClient.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2020 The zfoo Authors
+ *
+ * Licensed 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and limitations under the License.
+ */
+
+package com.zfoo.net.core.jprotobuf;
+
+import com.zfoo.net.core.AbstractClient;
+import com.zfoo.net.handler.ClientRouteHandler;
+import com.zfoo.net.handler.codec.jprotobuf.JProtobufTcpCodecHandler;
+import com.zfoo.net.handler.idle.ClientIdleHandler;
+import com.zfoo.util.net.HostAndPort;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.handler.timeout.IdleStateHandler;
+
+/**
+ * @author jaysunxiao
+ * @version 3.0
+ */
+public class JProtobufTcpClient extends AbstractClient {
+
+ public JProtobufTcpClient(HostAndPort host) {
+ super(host);
+ }
+
+ @Override
+ public ChannelInitializer extends Channel> channelChannelInitializer() {
+ return new ChannelHandlerInitializer();
+ }
+
+
+ private static class ChannelHandlerInitializer extends ChannelInitializer {
+ @Override
+ protected void initChannel(SocketChannel channel) {
+ channel.pipeline().addLast(new IdleStateHandler(0, 0, 60));
+ channel.pipeline().addLast(new ClientIdleHandler());
+ channel.pipeline().addLast(new JProtobufTcpCodecHandler());
+ channel.pipeline().addLast(new ClientRouteHandler());
+ }
+ }
+
+
+}
diff --git a/net/src/main/java/com/zfoo/net/core/jprotobuf/JProtobufTpcServer.java b/net/src/main/java/com/zfoo/net/core/jprotobuf/JProtobufTpcServer.java
new file mode 100644
index 00000000..d281ede8
--- /dev/null
+++ b/net/src/main/java/com/zfoo/net/core/jprotobuf/JProtobufTpcServer.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 The zfoo Authors
+ *
+ * Licensed 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and limitations under the License.
+ */
+
+package com.zfoo.net.core.jprotobuf;
+
+import com.zfoo.net.core.AbstractServer;
+import com.zfoo.net.handler.ServerRouteHandler;
+import com.zfoo.net.handler.codec.jprotobuf.JProtobufTcpCodecHandler;
+import com.zfoo.net.handler.idle.ServerIdleHandler;
+import com.zfoo.util.net.HostAndPort;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.handler.timeout.IdleStateHandler;
+
+/**
+ * @author jaysunxiao
+ * @version 3.0
+ */
+public class JProtobufTpcServer extends AbstractServer {
+
+ public JProtobufTpcServer(HostAndPort host) {
+ super(host);
+ }
+
+ @Override
+ public ChannelInitializer channelChannelInitializer() {
+ return new ChannelHandlerInitializer();
+ }
+
+
+ private static class ChannelHandlerInitializer extends ChannelInitializer {
+ @Override
+ protected void initChannel(SocketChannel channel) {
+ channel.pipeline().addLast(new IdleStateHandler(0, 0, 180));
+ channel.pipeline().addLast(new ServerIdleHandler());
+ channel.pipeline().addLast(new JProtobufTcpCodecHandler());
+ channel.pipeline().addLast(new ServerRouteHandler());
+ }
+ }
+}
diff --git a/net/src/main/java/com/zfoo/net/handler/codec/jprotobuf/JProtobufTcpCodecHandler.java b/net/src/main/java/com/zfoo/net/handler/codec/jprotobuf/JProtobufTcpCodecHandler.java
new file mode 100644
index 00000000..b43d3203
--- /dev/null
+++ b/net/src/main/java/com/zfoo/net/handler/codec/jprotobuf/JProtobufTcpCodecHandler.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2020 The zfoo Authors
+ *
+ * Licensed 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and limitations under the License.
+ */
+
+package com.zfoo.net.handler.codec.jprotobuf;
+
+import com.baidu.bjf.remoting.protobuf.Codec;
+import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
+import com.zfoo.net.packet.model.DecodedPacketInfo;
+import com.zfoo.net.packet.model.EncodedPacketInfo;
+import com.zfoo.net.packet.service.PacketService;
+import com.zfoo.net.router.attachment.IAttachment;
+import com.zfoo.net.util.SessionUtils;
+import com.zfoo.protocol.IPacket;
+import com.zfoo.protocol.ProtocolManager;
+import com.zfoo.protocol.buffer.ByteBufUtils;
+import com.zfoo.protocol.util.StringUtils;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.handler.codec.ByteToMessageCodec;
+import io.netty.util.ReferenceCountUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+import static com.zfoo.protocol.ProtocolManager.protocols;
+
+/**
+ * header(4byte) + protocolId(2byte) + packet
+ * header = body(bytes.length) + protocolId.length(2byte)
+ *
+ * @author jaysunxiao
+ * @version 3.0
+ */
+public class JProtobufTcpCodecHandler extends ByteToMessageCodec {
+
+ private static final Logger logger = LoggerFactory.getLogger(JProtobufTcpCodecHandler.class);
+
+ public static DecodedPacketInfo read(ByteBuf buffer) throws IOException {
+ var protocolId = ByteBufUtils.readShort(buffer);
+ var protocolRegistration = ProtocolManager.getProtocol(protocolId);
+ var protocolClass = protocols[protocolId].protocolConstructor().getDeclaringClass();
+
+ var protobufCodec = ProtobufProxy.create(protocolClass);
+
+ var bytes = ByteBufUtils.readAllBytes(buffer);
+ var packet = protobufCodec.decode(bytes);
+
+ // 解析包的附加包
+ var hasAttachment = ByteBufUtils.tryReadBoolean(buffer);
+ IAttachment attachment = null;
+ if (hasAttachment) {
+
+ }
+ return DecodedPacketInfo.valueOf((IPacket) packet, attachment);
+ }
+
+ @Override
+ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List