public class FlooMessage implements Base { String name = "msg"; public int req_id = Utils.getRequestId(); String data; public FlooMessage(String chatContents) { data = chatContents; } }
@Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); SSLContext sslContext = Utils.createSSLContext(); SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(true); pipeline.addLast("ssl", new SslHandler(engine)); pipeline.addLast("framer", new LineBasedFrameDecoder(1000 * 1000 * 10, true, false)); pipeline.addLast("decoder", new StringDecoder(CharsetUtil.UTF_8)); pipeline.addLast("encoder", new StringEncoder(CharsetUtil.UTF_8)); pipeline.addLast("handler", connection); }
public class SetBuf implements Base { public String name = "set_buf"; public int req_id = Utils.getRequestId(); public Integer id; public String buf; public String md5; public String encoding; public SetBuf(Buf buf) { this.md5 = buf.md5; this.id = buf.id; this.buf = buf.serialize(); this.encoding = buf.encoding.toString(); } }