use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project graylog2-server by Graylog2.
the class UdpTransportTest method launchTransportForBootStrapTest.
private UdpTransport launchTransportForBootStrapTest(final ChannelInboundHandler channelHandler) throws MisfireException {
final UdpTransport transport = new UdpTransport(CONFIGURATION, eventLoopGroupFactory, nettyTransportConfiguration, throughputCounter, new LocalMetricRegistry()) {
@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChannelHandlers(MessageInput input) {
final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
handlers.put("logging", () -> new LoggingHandler(LogLevel.INFO));
handlers.put("counter", () -> channelHandler);
handlers.putAll(super.getChannelHandlers(input));
return handlers;
}
};
final MessageInput messageInput = mock(MessageInput.class);
when(messageInput.getId()).thenReturn("TEST");
when(messageInput.getName()).thenReturn("TEST");
transport.launch(messageInput);
return transport;
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project pravega by pravega.
the class PravegaConnectionListener method createEncodingStack.
@Override
public List<ChannelHandler> createEncodingStack(String connectionName) {
List<ChannelHandler> stack = new ArrayList<>();
stack.add(new ExceptionLoggingHandler(connectionName));
stack.add(new CommandEncoder(null, NO_OP_METRIC_NOTIFIER));
stack.add(new LengthFieldBasedFrameDecoder(MAX_WIRECOMMAND_SIZE, 4, 4));
stack.add(new CommandDecoder());
stack.add(new AppendDecoder());
return stack;
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project pravega by pravega.
the class AdminConnectionListener method createEncodingStack.
@Override
public List<ChannelHandler> createEncodingStack(String connectionName) {
List<ChannelHandler> stack = new ArrayList<>();
stack.add(new ExceptionLoggingHandler(connectionName));
stack.add(new CommandEncoder(null, NO_OP_METRIC_NOTIFIER));
stack.add(new LengthFieldBasedFrameDecoder(MAX_WIRECOMMAND_SIZE, 4, 4));
stack.add(new CommandDecoder());
return stack;
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project janusgraph by JanusGraph.
the class SaslAndHMACAuthenticationHandlerTest method testHttpChannelReadWhenAuthenticatorHasBeenAdded.
@Test
public void testHttpChannelReadWhenAuthenticatorHasBeenAdded() throws Exception {
final SaslAndHMACAuthenticator authenticator = createMock(SaslAndHMACAuthenticator.class);
final HMACAuthenticator hmacAuth = createMock(HMACAuthenticator.class);
final ChannelHandlerContext ctx = createMock(ChannelHandlerContext.class);
final ChannelHandler mockHandler = createMock(ChannelHandler.class);
final ChannelPipeline pipeline = createMock(ChannelPipeline.class);
final HttpMessage msg = createMock(HttpMessage.class);
final HttpHeaders headers = createMock(HttpHeaders.class);
expect(authenticator.getHMACAuthenticator()).andReturn(hmacAuth);
expect(authenticator.getSimpleAuthenticator()).andReturn(createMock(JanusGraphSimpleAuthenticator.class));
expect(ctx.pipeline()).andReturn(pipeline);
expect(pipeline.get("hmac_authenticator")).andReturn(mockHandler);
expect(msg.headers()).andReturn(headers).times(2);
expect(headers.get(isA(String.class))).andReturn(null).times(2);
expect(ctx.fireChannelRead(eq(msg))).andReturn(ctx);
replayAll();
final SaslAndHMACAuthenticationHandler handler = new SaslAndHMACAuthenticationHandler(authenticator, null);
handler.channelRead(ctx, msg);
}
use of org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandler in project riposte by Nike-Inc.
the class ChannelPipelineFinalizerHandlerTest method finalizeChannelPipeline_should_add_idle_channel_timeout_handler_first_in_pipeline_if_workerChannelIdleTimeoutMillis_is_greater_than_0.
@Test
public void finalizeChannelPipeline_should_add_idle_channel_timeout_handler_first_in_pipeline_if_workerChannelIdleTimeoutMillis_is_greater_than_0() throws JsonProcessingException {
// given
LastOutboundMessage msg = mock(LastOutboundMessage.class);
// when
handler.finalizeChannelPipeline(ctxMock, msg, state, null);
// then
ArgumentCaptor<ChannelHandler> idleHandlerArgCaptor = ArgumentCaptor.forClass(ChannelHandler.class);
verify(pipelineMock).addFirst(eq(IDLE_CHANNEL_TIMEOUT_HANDLER_NAME), idleHandlerArgCaptor.capture());
ChannelHandler handlerRegistered = idleHandlerArgCaptor.getValue();
assertThat(handlerRegistered, instanceOf(IdleChannelTimeoutHandler.class));
IdleChannelTimeoutHandler idleHandler = (IdleChannelTimeoutHandler) handlerRegistered;
long idleValue = (long) Whitebox.getInternalState(idleHandler, "idleTimeoutMillis");
assertThat(idleValue, is(workerChannelIdleTimeoutMillis));
}
Aggregations