Search in sources :

Example 1 with NullChannelHandlerProvider

use of com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider in project zuul by Netflix.

the class BaseServerStartup method addChannelDependencies.

protected void addChannelDependencies(ChannelConfig channelDeps, @SuppressWarnings("unused") String listenAddressName) {
    // listenAddressName is used by subclasses
    channelDeps.set(ZuulDependencyKeys.registry, registry);
    channelDeps.set(ZuulDependencyKeys.applicationInfoManager, applicationInfoManager);
    channelDeps.set(ZuulDependencyKeys.serverStatusManager, serverStatusManager);
    channelDeps.set(ZuulDependencyKeys.accessLogPublisher, accessLogPublisher);
    channelDeps.set(ZuulDependencyKeys.sessionCtxDecorator, sessionCtxDecorator);
    channelDeps.set(ZuulDependencyKeys.requestCompleteHandler, reqCompleteHandler);
    final Counter httpRequestReadTimeoutCounter = registry.counter("server.http.request.read.timeout");
    channelDeps.set(ZuulDependencyKeys.httpRequestReadTimeoutCounter, httpRequestReadTimeoutCounter);
    channelDeps.set(ZuulDependencyKeys.filterLoader, filterLoader);
    channelDeps.set(ZuulDependencyKeys.filterUsageNotifier, usageNotifier);
    channelDeps.set(ZuulDependencyKeys.eventLoopGroupMetrics, eventLoopGroupMetrics);
    channelDeps.set(ZuulDependencyKeys.sslClientCertCheckChannelHandlerProvider, new NullChannelHandlerProvider());
    channelDeps.set(ZuulDependencyKeys.rateLimitingChannelHandlerProvider, new NullChannelHandlerProvider());
}
Also used : Counter(com.netflix.spectator.api.Counter) NullChannelHandlerProvider(com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider)

Example 2 with NullChannelHandlerProvider

use of com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider in project zuul by Netflix.

the class BaseZuulChannelInitializerTest method tcpHandlersAdded_withProxyProtocol.

@Test
public void tcpHandlersAdded_withProxyProtocol() {
    ChannelConfig channelConfig = new ChannelConfig();
    channelConfig.set(CommonChannelConfigKeys.withProxyProtocol, true);
    ChannelConfig channelDependencies = new ChannelConfig();
    channelDependencies.set(ZuulDependencyKeys.registry, new NoopRegistry());
    channelDependencies.set(ZuulDependencyKeys.rateLimitingChannelHandlerProvider, new NullChannelHandlerProvider());
    channelDependencies.set(ZuulDependencyKeys.sslClientCertCheckChannelHandlerProvider, new NullChannelHandlerProvider());
    ChannelGroup channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
    BaseZuulChannelInitializer init = new BaseZuulChannelInitializer("1234", channelConfig, channelDependencies, channelGroup) {

        @Override
        protected void initChannel(Channel ch) {
        }
    };
    EmbeddedChannel channel = new EmbeddedChannel();
    init.addTcpRelatedHandlers(channel.pipeline());
    assertNotNull(channel.pipeline().context(SourceAddressChannelHandler.class));
    assertNotNull(channel.pipeline().context(PerEventLoopMetricsChannelHandler.Connections.class));
    assertNotNull(channel.pipeline().context(ElbProxyProtocolChannelHandler.NAME));
    assertNotNull(channel.pipeline().context(MaxInboundConnectionsHandler.class));
}
Also used : DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) SourceAddressChannelHandler(com.netflix.netty.common.SourceAddressChannelHandler) ChannelConfig(com.netflix.netty.common.channel.config.ChannelConfig) NoopRegistry(com.netflix.spectator.api.NoopRegistry) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Channel(io.netty.channel.Channel) MaxInboundConnectionsHandler(com.netflix.netty.common.throttle.MaxInboundConnectionsHandler) NullChannelHandlerProvider(com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) ChannelGroup(io.netty.channel.group.ChannelGroup) DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) Test(org.junit.Test)

Example 3 with NullChannelHandlerProvider

use of com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider in project zuul by Netflix.

the class BaseZuulChannelInitializerTest method tcpHandlersAdded.

@Test
public void tcpHandlersAdded() {
    ChannelConfig channelConfig = new ChannelConfig();
    ChannelConfig channelDependencies = new ChannelConfig();
    channelDependencies.set(ZuulDependencyKeys.registry, new NoopRegistry());
    channelDependencies.set(ZuulDependencyKeys.rateLimitingChannelHandlerProvider, new NullChannelHandlerProvider());
    channelDependencies.set(ZuulDependencyKeys.sslClientCertCheckChannelHandlerProvider, new NullChannelHandlerProvider());
    ChannelGroup channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
    BaseZuulChannelInitializer init = new BaseZuulChannelInitializer("1234", channelConfig, channelDependencies, channelGroup) {

        @Override
        protected void initChannel(Channel ch) {
        }
    };
    EmbeddedChannel channel = new EmbeddedChannel();
    init.addTcpRelatedHandlers(channel.pipeline());
    assertNotNull(channel.pipeline().context(SourceAddressChannelHandler.class));
    assertNotNull(channel.pipeline().context(PerEventLoopMetricsChannelHandler.Connections.class));
    assertNotNull(channel.pipeline().context(ElbProxyProtocolChannelHandler.NAME));
    assertNotNull(channel.pipeline().context(MaxInboundConnectionsHandler.class));
}
Also used : DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) SourceAddressChannelHandler(com.netflix.netty.common.SourceAddressChannelHandler) ChannelConfig(com.netflix.netty.common.channel.config.ChannelConfig) NoopRegistry(com.netflix.spectator.api.NoopRegistry) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Channel(io.netty.channel.Channel) MaxInboundConnectionsHandler(com.netflix.netty.common.throttle.MaxInboundConnectionsHandler) NullChannelHandlerProvider(com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) ChannelGroup(io.netty.channel.group.ChannelGroup) DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) Test(org.junit.Test)

Example 4 with NullChannelHandlerProvider

use of com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider in project zuul by Netflix.

the class BaseZuulChannelInitializerTest method serverStateHandlerAdded.

@Test
public void serverStateHandlerAdded() {
    ChannelConfig channelConfig = new ChannelConfig();
    ChannelConfig channelDependencies = new ChannelConfig();
    channelDependencies.set(ZuulDependencyKeys.registry, new NoopRegistry());
    channelDependencies.set(ZuulDependencyKeys.rateLimitingChannelHandlerProvider, new NullChannelHandlerProvider());
    channelDependencies.set(ZuulDependencyKeys.sslClientCertCheckChannelHandlerProvider, new NullChannelHandlerProvider());
    ChannelGroup channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
    BaseZuulChannelInitializer init = new BaseZuulChannelInitializer("1234", channelConfig, channelDependencies, channelGroup) {

        @Override
        protected void initChannel(Channel ch) {
        }
    };
    EmbeddedChannel channel = new EmbeddedChannel();
    init.addPassportHandler(channel.pipeline());
    assertNotNull(channel.pipeline().context(ServerStateHandler.InboundHandler.class));
    assertNotNull(channel.pipeline().context(ServerStateHandler.OutboundHandler.class));
}
Also used : DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) ChannelConfig(com.netflix.netty.common.channel.config.ChannelConfig) NoopRegistry(com.netflix.spectator.api.NoopRegistry) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) Channel(io.netty.channel.Channel) NullChannelHandlerProvider(com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) ChannelGroup(io.netty.channel.group.ChannelGroup) DefaultChannelGroup(io.netty.channel.group.DefaultChannelGroup) Test(org.junit.Test)

Aggregations

NullChannelHandlerProvider (com.netflix.zuul.netty.ratelimiting.NullChannelHandlerProvider)4 ChannelConfig (com.netflix.netty.common.channel.config.ChannelConfig)3 NoopRegistry (com.netflix.spectator.api.NoopRegistry)3 Channel (io.netty.channel.Channel)3 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)3 ChannelGroup (io.netty.channel.group.ChannelGroup)3 DefaultChannelGroup (io.netty.channel.group.DefaultChannelGroup)3 Test (org.junit.Test)3 SourceAddressChannelHandler (com.netflix.netty.common.SourceAddressChannelHandler)2 MaxInboundConnectionsHandler (com.netflix.netty.common.throttle.MaxInboundConnectionsHandler)2 Counter (com.netflix.spectator.api.Counter)1