channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000))
channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000))
channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000))
channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000))
/** * Adds channel handlers that perform encryption / decryption of data using SASL. * * @param channel The channel. * @param backend The SASL backend. * @param maxOutboundBlockSize Max size in bytes of outgoing encrypted blocks, to control * memory usage. */ static void addToChannel( Channel channel, SaslEncryptionBackend backend, int maxOutboundBlockSize) { channel.pipeline() .addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(backend, maxOutboundBlockSize)) .addFirst("saslDecryption", new DecryptionHandler(backend)) .addFirst("saslFrameDecoder", NettyUtils.createFrameDecoder()); }
/** * Adds channel handlers that perform encryption / decryption of data using SASL. * * @param channel The channel. * @param backend The SASL backend. * @param maxOutboundBlockSize Max size in bytes of outgoing encrypted blocks, to control * memory usage. */ static void addToChannel( Channel channel, SaslEncryptionBackend backend, int maxOutboundBlockSize) { channel.pipeline() .addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(backend, maxOutboundBlockSize)) .addFirst("saslDecryption", new DecryptionHandler(backend)) .addFirst("saslFrameDecoder", NettyUtils.createFrameDecoder()); }
/** * Adds channel handlers that perform encryption / decryption of data using SASL. * * @param channel The channel. * @param backend The SASL backend. * @param maxOutboundBlockSize Max size in bytes of outgoing encrypted blocks, to control * memory usage. */ static void addToChannel( Channel channel, SaslEncryptionBackend backend, int maxOutboundBlockSize) { channel.pipeline() .addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(backend, maxOutboundBlockSize)) .addFirst("saslDecryption", new DecryptionHandler(backend)) .addFirst("saslFrameDecoder", NettyUtils.createFrameDecoder()); }
/** * Adds channel handlers that perform encryption / decryption of data using SASL. * * @param channel The channel. * @param backend The SASL backend. * @param maxOutboundBlockSize Max size in bytes of outgoing encrypted blocks, to control * memory usage. */ static void addToChannel( Channel channel, SaslEncryptionBackend backend, int maxOutboundBlockSize) { channel.pipeline() .addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(backend, maxOutboundBlockSize)) .addFirst("saslDecryption", new DecryptionHandler(backend)) .addFirst("saslFrameDecoder", NettyUtils.createFrameDecoder()); }
private void testClientToServer(Message msg) { EmbeddedChannel clientChannel = new EmbeddedChannel(new FileRegionEncoder(), MessageEncoder.INSTANCE); clientChannel.writeOutbound(msg); EmbeddedChannel serverChannel = new EmbeddedChannel( NettyUtils.createFrameDecoder(), MessageDecoder.INSTANCE); while (!clientChannel.outboundMessages().isEmpty()) { serverChannel.writeOneInbound(clientChannel.readOutbound()); } assertEquals(1, serverChannel.inboundMessages().size()); assertEquals(msg, serverChannel.readInbound()); }
private void testServerToClient(Message msg) { EmbeddedChannel serverChannel = new EmbeddedChannel(new FileRegionEncoder(), MessageEncoder.INSTANCE); serverChannel.writeOutbound(msg); EmbeddedChannel clientChannel = new EmbeddedChannel( NettyUtils.createFrameDecoder(), MessageDecoder.INSTANCE); while (!serverChannel.outboundMessages().isEmpty()) { clientChannel.writeInbound(serverChannel.readOutbound()); } assertEquals(1, clientChannel.inboundMessages().size()); assertEquals(msg, clientChannel.readInbound()); }
private void testClientToServer(Message msg) { EmbeddedChannel clientChannel = new EmbeddedChannel(new FileRegionEncoder(), MessageEncoder.INSTANCE); clientChannel.writeOutbound(msg); EmbeddedChannel serverChannel = new EmbeddedChannel( NettyUtils.createFrameDecoder(), MessageDecoder.INSTANCE); while (!clientChannel.outboundMessages().isEmpty()) { serverChannel.writeInbound(clientChannel.readOutbound()); } assertEquals(1, serverChannel.inboundMessages().size()); assertEquals(msg, serverChannel.readInbound()); }
private void testServerToClient(Message msg) { EmbeddedChannel serverChannel = new EmbeddedChannel(new FileRegionEncoder(), MessageEncoder.INSTANCE); serverChannel.writeOutbound(msg); EmbeddedChannel clientChannel = new EmbeddedChannel( NettyUtils.createFrameDecoder(), MessageDecoder.INSTANCE); while (!serverChannel.outboundMessages().isEmpty()) { clientChannel.writeOneInbound(serverChannel.readOutbound()); } assertEquals(1, clientChannel.inboundMessages().size()); assertEquals(msg, clientChannel.readInbound()); }