io.netty.handler.traffic.GlobalTrafficShapingHandler Java Examples

The following examples show how to use io.netty.handler.traffic.GlobalTrafficShapingHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyToServerConnection.java    From PowerTunnel with MIT License 6 votes vote down vote up
private ProxyToServerConnection(
        DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        ChainedProxy chainedProxy,
        Queue<ChainedProxy> availableChainedProxies,
        HttpFilters initialFilters,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    super(DISCONNECTED, proxyServer, true);
    this.clientConnection = clientConnection;
    this.serverHostAndPort = serverHostAndPort;
    this.chainedProxy = chainedProxy;
    this.availableChainedProxies = availableChainedProxies;
    this.trafficHandler = globalTrafficShapingHandler;
    this.currentFilters = initialFilters;

    // Report connection status to HttpFilters
    currentFilters.proxyToServerConnectionQueued();

    setupConnectionParameters();
}
 
Example #2
Source File: GlobalTrafficShapingProvider.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@Override
public @NotNull GlobalTrafficShapingHandler get() {

    final ThreadFactory threadFactory = ThreadFactoryUtil.create("global-traffic-shaper-executor-%d");
    final ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(threadFactory);

    final GlobalTrafficShaperExecutorShutdownHook shutdownHook = new GlobalTrafficShaperExecutorShutdownHook(scheduledExecutorService);
    registry.add(shutdownHook);

    final long incomingLimit = restrictionsConfigurationService.incomingLimit();
    log.debug("Throttling incoming traffic to {} B/s", incomingLimit);

    final long outgoinglimit = InternalConfigurations.OUTGOING_BANDWIDTH_THROTTLING_DEFAULT;
    log.debug("Throttling outgoing traffic to {} B/s", outgoinglimit);

    return new GlobalTrafficShapingHandler(scheduledExecutorService, outgoinglimit, incomingLimit, 1000L);
}
 
Example #3
Source File: Configuration.java    From AgentX with Apache License 2.0 6 votes vote down vote up
public static void init() throws Exception {
    if (INSTANCE != null) {
        return;
    }
    log.info("\tLoading configuration file...");
    load();
    log.info("\tChecking configuration items...");
    check();
    if (INSTANCE.relayPort.length > 0) {
        log.info("\tStarting Relays...");
        startupRelays();
    }
    log.info("\tInitializing dns cache...");
    DnsCache.init(INSTANCE.dnsCacheCapacity);
    log.info("\tInitializing global network traffic handler...");
    TRAFFIC_HANDLER = new GlobalTrafficShapingHandler(Executors.newScheduledThreadPool(1), 1000);
    TRAFFIC_HANDLER.setWriteLimit(INSTANCE.writeLimit);
    TRAFFIC_HANDLER.setReadLimit(INSTANCE.readLimit);
    log.info("\tEnd of configuration");
}
 
Example #4
Source File: ProxyToServerConnection.java    From yfs with Apache License 2.0 6 votes vote down vote up
private ProxyToServerConnection(
        DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        ChainedProxy chainedProxy,
        Queue<ChainedProxy> availableChainedProxies,
        HttpFilters initialFilters,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    super(DISCONNECTED, proxyServer, true);
    this.clientConnection = clientConnection;
    this.serverHostAndPort = serverHostAndPort;
    this.chainedProxy = chainedProxy;
    this.availableChainedProxies = availableChainedProxies;
    this.trafficHandler = globalTrafficShapingHandler;
    this.currentFilters = initialFilters;

    // Report connection status to HttpFilters
    currentFilters.proxyToServerConnectionQueued();

    setupConnectionParameters();
}
 
Example #5
Source File: ProxyToServerConnection.java    From g4proxy with Apache License 2.0 6 votes vote down vote up
private ProxyToServerConnection(
        DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        ChainedProxy chainedProxy,
        Queue<ChainedProxy> availableChainedProxies,
        HttpFilters initialFilters,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    super(DISCONNECTED, proxyServer, true);
    this.clientConnection = clientConnection;
    this.serverHostAndPort = serverHostAndPort;
    this.chainedProxy = chainedProxy;
    this.availableChainedProxies = availableChainedProxies;
    this.trafficHandler = globalTrafficShapingHandler;
    this.currentFilters = initialFilters;

    // Report connection status to HttpFilters
    currentFilters.proxyToServerConnectionQueued();

    setupConnectionParameters();
}
 
Example #6
Source File: SocksServer.java    From NSS with Apache License 2.0 5 votes vote down vote up
public void start() {
	try {

		FSClient.start();

		Config config = ConfigXmlLoader.load(CONFIG);
		PacLoader.load(PAC);

		bossGroup = new NioEventLoopGroup(1);
		workerGroup = new NioEventLoopGroup();
		bootstrap = new ServerBootstrap();
		trafficHandler = new GlobalTrafficShapingHandler(
				Executors.newScheduledThreadPool(2), 1000);

		bootstrap
				.group(bossGroup, workerGroup)
				.channel(NioServerSocketChannel.class)
				.childHandler(
						new SocksServerInitializer(config, trafficHandler));

		logger.info("Start At Port " + config.get_localPort());
		startMBean();
		bootstrap.bind(config.get_localPort()).sync().channel()
				.closeFuture().sync();
	} catch (Exception e) {
		logger.error("start error", e);
	} finally {
		stop();
	}
}
 
Example #7
Source File: ProxyToServerConnection.java    From PowerTunnel with MIT License 5 votes vote down vote up
/**
 * Create a new ProxyToServerConnection.
 */
static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer,
                                      ClientToProxyConnection clientConnection,
                                      String serverHostAndPort,
                                      HttpFilters initialFilters,
                                      HttpRequest initialHttpRequest,
                                      GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<>();
    ChainedProxyManager chainedProxyManager = proxyServer
            .getChainProxyManager();
    if (chainedProxyManager != null) {
        chainedProxyManager.lookupChainedProxies(initialHttpRequest,
                chainedProxies, clientConnection.getClientDetails());
        if (chainedProxies.size() == 0) {
            // ChainedProxyManager returned no proxies, can't connect
            return null;
        }
    }
    return new ProxyToServerConnection(proxyServer,
            clientConnection,
            serverHostAndPort,
            chainedProxies.poll(),
            chainedProxies,
            initialFilters,
            globalTrafficShapingHandler);
}
 
Example #8
Source File: XServer.java    From AgentX with Apache License 2.0 5 votes vote down vote up
public void start() {
    Configuration config = Configuration.INSTANCE;
    InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
    EventLoopGroup bossGroup = new NioEventLoopGroup(1);
    EventLoopGroup workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap bootstrap = new ServerBootstrap();
        bootstrap.group(bossGroup, workerGroup)
                .channel(NioServerSocketChannel.class)
                .childHandler(new ChannelInitializer<SocketChannel>() {
                    protected void initChannel(SocketChannel socketChannel) throws Exception {
                        socketChannel.pipeline()
                                .addLast("logging", new LoggingHandler(LogLevel.DEBUG))
                                .addLast(new XConnectHandler());
                        if (config.getReadLimit() != 0 || config.getWriteLimit() != 0) {
                            socketChannel.pipeline().addLast(
                                    new GlobalTrafficShapingHandler(Executors.newScheduledThreadPool(1), config.getWriteLimit(), config.getReadLimit())
                            );
                        }
                    }
                });
        log.info("\tStartup {}-{}-server [{}]", Constants.APP_NAME, Constants.APP_VERSION, config.getProtocol());
        new Thread(() -> new UdpServer().start()).start();
        ChannelFuture future = bootstrap.bind(config.getHost(), config.getPort()).sync();
        future.addListener(future1 -> log.info("\tTCP listening at {}:{}...", config.getHost(), config.getPort()));
        future.channel().closeFuture().sync();
    } catch (Exception e) {
        log.error("\tSocket bind failure ({})", e.getMessage());
    } finally {
        log.info("\tShutting down and recycling...");
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
        Configuration.shutdownRelays();
    }
    System.exit(0);
}
 
Example #9
Source File: ProxyToServerConnection.java    From yfs with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new ProxyToServerConnection.
 *
 * @param proxyServer
 * @param clientConnection
 * @param serverHostAndPort
 * @param initialFilters
 * @param initialHttpRequest
 * @return
 * @throws UnknownHostException
 */
static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer,
                                      ClientToProxyConnection clientConnection,
                                      String serverHostAndPort,
                                      HttpFilters initialFilters,
                                      HttpRequest initialHttpRequest,
                                      GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<ChainedProxy>();
    ChainedProxyManager chainedProxyManager = proxyServer
            .getChainProxyManager();
    if (chainedProxyManager != null) {
        chainedProxyManager.lookupChainedProxies(initialHttpRequest,
                chainedProxies);
        if (chainedProxies.size() == 0) {
            // ChainedProxyManager returned no proxies, can't connect
            return null;
        }
    }
    return new ProxyToServerConnection(proxyServer,
            clientConnection,
            serverHostAndPort,
            chainedProxies.poll(),
            chainedProxies,
            initialFilters,
            globalTrafficShapingHandler);
}
 
Example #10
Source File: ClientToProxyConnection.java    From yfs with Apache License 2.0 5 votes vote down vote up
ClientToProxyConnection(
        final DefaultHttpProxyServer proxyServer,
        SslEngineSource sslEngineSource,
        boolean authenticateClients,
        ChannelPipeline pipeline,
        GlobalTrafficShapingHandler globalTrafficShapingHandler) {
    super(AWAITING_INITIAL, proxyServer, false);

    initChannelPipeline(pipeline);

    if (sslEngineSource != null) {
        LOG.debug("Enabling encryption of traffic from client to proxy");
        encrypt(pipeline, sslEngineSource.newSslEngine(),
                authenticateClients)
                .addListener(
                        new GenericFutureListener<Future<? super Channel>>() {
                            @Override
                            public void operationComplete(
                                    Future<? super Channel> future)
                                    throws Exception {
                                if (future.isSuccess()) {
                                    clientSslSession = sslEngine
                                            .getSession();
                                    recordClientSSLHandshakeSucceeded();
                                }
                            }
                        });
    }
    this.globalTrafficShapingHandler = globalTrafficShapingHandler;

    LOG.debug("Created ClientToProxyConnection");
}
 
Example #11
Source File: DefaultHttpProxyServer.java    From g4proxy with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new GlobalTrafficShapingHandler for this HttpProxyServer, using this proxy's proxyToServerEventLoop.
 *
 * @param transportProtocol
 * @param readThrottleBytesPerSecond
 * @param writeThrottleBytesPerSecond
 * @return
 */
private GlobalTrafficShapingHandler createGlobalTrafficShapingHandler(TransportProtocol transportProtocol, long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond) {
    EventLoopGroup proxyToServerEventLoop = this.getProxyToServerWorkerFor(transportProtocol);
    return new GlobalTrafficShapingHandler(proxyToServerEventLoop,
            writeThrottleBytesPerSecond,
            readThrottleBytesPerSecond,
            TRAFFIC_SHAPING_CHECK_INTERVAL_MS,
            Long.MAX_VALUE);
}
 
Example #12
Source File: ProxyToServerConnection.java    From g4proxy with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new ProxyToServerConnection.
 *
 * @param proxyServer
 * @param clientConnection
 * @param serverHostAndPort
 * @param initialFilters
 * @param initialHttpRequest
 * @return
 * @throws UnknownHostException
 */
static ProxyToServerConnection create(DefaultHttpProxyServer proxyServer,
        ClientToProxyConnection clientConnection,
        String serverHostAndPort,
        HttpFilters initialFilters,
        HttpRequest initialHttpRequest,
        GlobalTrafficShapingHandler globalTrafficShapingHandler)
        throws UnknownHostException {
    Queue<ChainedProxy> chainedProxies = new ConcurrentLinkedQueue<ChainedProxy>();
    ChainedProxyManager chainedProxyManager = proxyServer
            .getChainProxyManager();
    if (chainedProxyManager != null) {
        chainedProxyManager.lookupChainedProxies(initialHttpRequest,
                chainedProxies);
        if (chainedProxies.size() == 0) {
            // ChainedProxyManager returned no proxies, can't connect
            return null;
        }
    }
    return new ProxyToServerConnection(proxyServer,
            clientConnection,
            serverHostAndPort,
            chainedProxies.poll(),
            chainedProxies,
            initialFilters,
            globalTrafficShapingHandler);
}
 
Example #13
Source File: ClientToProxyConnection.java    From g4proxy with Apache License 2.0 5 votes vote down vote up
ClientToProxyConnection(
        final DefaultHttpProxyServer proxyServer,
        SslEngineSource sslEngineSource,
        boolean authenticateClients,
        ChannelPipeline pipeline,
        GlobalTrafficShapingHandler globalTrafficShapingHandler) {
    super(AWAITING_INITIAL, proxyServer, false);

    initChannelPipeline(pipeline);

    if (sslEngineSource != null) {
        LOG.debug("Enabling encryption of traffic from client to proxy");
        encrypt(pipeline, sslEngineSource.newSslEngine(),
                authenticateClients)
                .addListener(
                        new GenericFutureListener<Future<? super Channel>>() {
                            @Override
                            public void operationComplete(
                                    Future<? super Channel> future)
                                    throws Exception {
                                if (future.isSuccess()) {
                                    clientSslSession = sslEngine
                                            .getSession();
                                    recordClientSSLHandshakeSucceeded();
                                }
                            }
                        });
    }
    this.globalTrafficShapingHandler = globalTrafficShapingHandler;

    LOG.debug("Created ClientToProxyConnection");
}
 
Example #14
Source File: ThrottlingModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Test
public void test_traffic_shaping_handler_is_singleton() throws Exception {

    final GlobalTrafficShapingHandler instance = injector.getInstance(GlobalTrafficShapingHandler.class);
    final GlobalTrafficShapingHandler instance2 = injector.getInstance(GlobalTrafficShapingHandler.class);

    assertSame(instance, instance2);
}
 
Example #15
Source File: AbstractChannelInitializerTest.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@Before
public void before() {
    MockitoAnnotations.initMocks(this);

    when(socketChannel.pipeline()).thenReturn(pipeline);
    when(socketChannel.attr(any(AttributeKey.class))).thenReturn(attribute);

    when(channelDependencies.getGlobalTrafficShapingHandler())
            .thenReturn(new GlobalTrafficShapingHandler(Executors.newSingleThreadScheduledExecutor(), 1000L));

    when(channelDependencies.getConfigurationService()).thenReturn(configurationService);
    when(configurationService.mqttConfiguration()).thenReturn(mqttConfigurationService);

    when(channelDependencies.getRestrictionsConfigurationService()).thenReturn(restrictionsConfigurationService);

    when(restrictionsConfigurationService.noConnectIdleTimeout()).thenReturn(500L);

    abstractChannelInitializer = new TestAbstractChannelInitializer(channelDependencies);
}
 
Example #16
Source File: NettyModuleTest.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@Test
public void test_netty_configuration_is_singleton() throws Exception {

    final Injector injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            install(new NettyModule());
            bind(LifecycleEventListeners.class).toInstance(mock(LifecycleEventListeners.class));
            bind(ScheduledExecutorService.class).annotatedWith(Security.class).toInstance(mock(ListeningScheduledExecutorService.class));
            bind(RestrictionsConfigurationService.class).toInstance(mock(RestrictionsConfigurationService.class));
            bind(RetainedMessagePersistence.class).toInstance(mock(RetainedMessagePersistence.class));
            bind(Authorizers.class).toInstance(mock(Authorizers.class));
            bind(PluginOutPutAsyncer.class).toInstance(mock(PluginOutPutAsyncer.class));
            bind(MessageDroppedService.class).toInstance(mock(MessageDroppedService.class));
            bind(PublishPayloadPersistence.class).toInstance(mock(PublishPayloadPersistence.class));
            bind(TopicAliasLimiter.class).toInstance(mock(TopicAliasLimiter.class));
            bind(ChannelPersistence.class).toInstance(mock(ChannelPersistence.class));
            bind(ChannelDependencies.class).toInstance(mock(ChannelDependencies.class));
            bind(SslContextFactory.class).toInstance(mock(SslContextFactory.class));
            bind(InternalListenerConfigurationService.class).toInstance(mock(InternalListenerConfigurationService.class));
            bind(PluginTaskExecutorService.class).toInstance(mock(PluginTaskExecutorService.class));
            bind(ClientSessionPersistence.class).toInstance(mock(ClientSessionPersistence.class));
            bind(MetricsHolder.class).toInstance(mock(MetricsHolder.class));
            bind(IncomingMessageFlowPersistence.class).toInstance(mock(IncomingMessageFlowPersistence.class));
            bind(FullConfigurationService.class).toInstance(mock(FullConfigurationService.class));
            bind(ClientSessionSubscriptionPersistence.class).toInstance(mock(ClientSessionSubscriptionPersistence.class));
            bind(Authenticators.class).toInstance(mock(Authenticators.class));
            bind(SecurityConfigurationService.class).toInstance(mock(SecurityConfigurationService.class));
            bind(Initializers.class).toInstance(mock(Initializers.class));
            bind(MqttConfigurationService.class).toInstance(mock(MqttConfigurationService.class));
            bind(GlobalTrafficCounter.class).toInstance(mock(GlobalTrafficCounter.class));
            bind(GlobalTrafficShapingHandler.class).toInstance(mock(GlobalTrafficShapingHandler.class));
            bind(InternalPublishService.class).toInstance(mock(InternalPublishService.class));
            bind(PublishPollService.class).toInstance(mock(PublishPollService.class));
            bind(ServerInformation.class).toInstance(mock(ServerInformation.class));
            bind(LocalTopicTree.class).toInstance(mock(TopicTreeImpl.class));
            bind(SharedSubscriptionService.class).toInstance(mock(SharedSubscriptionService.class));
            bindScope(LazySingleton.class, LazySingletonScope.get());
        }
    });

    final NettyConfiguration instance = injector.getInstance(NettyConfiguration.class);
    final NettyConfiguration instance2 = injector.getInstance(NettyConfiguration.class);

    assertSame(instance, instance2);
}
 
Example #17
Source File: ExtensionModuleTest.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);

    injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {

            final MetricsHolder metricsHolder = mock(MetricsHolder.class);
            when(metricsHolder.getMetricRegistry()).thenReturn(new MetricRegistry());
            install(new ExtensionModule());
            bind(SystemInformation.class).toInstance(new SystemInformationImpl());
            bind(ChannelPersistence.class).toInstance(mock(ChannelPersistence.class));
            bind(FullConfigurationService.class).toInstance(new TestConfigurationBootstrap().getFullConfigurationService());
            bind(MqttConfigurationService.class).toInstance(mock(MqttConfigurationService.class));
            bind(RestrictionsConfigurationService.class).toInstance(mock(RestrictionsConfigurationService.class));
            bind(InternalListenerConfigurationService.class).toInstance(mock(InternalListenerConfigurationService.class));
            bind(SecurityConfigurationService.class).toInstance(mock(SecurityConfigurationService.class));
            bind(TopicAliasLimiter.class).toInstance(mock(TopicAliasLimiter.class));
            bind(MessageDroppedService.class).toInstance(mock(MessageDroppedService.class));
            bind(PublishPollService.class).toInstance(mock(PublishPollService.class));
            bind(ClientQueuePersistence.class).toInstance(mock(ClientQueuePersistence.class));
            bind(SharedSubscriptionService.class).toInstance(mock(SharedSubscriptionService.class));
            bind(IncomingMessageFlowPersistence.class).toInstance(mock(IncomingMessageFlowPersistence.class));
            bind(ChannelGroup.class).toInstance(mock(ChannelGroup.class));
            bind(GlobalTrafficCounter.class).toInstance(mock(GlobalTrafficCounter.class));
            bind(GlobalTrafficShapingHandler.class).toInstance(mock(GlobalTrafficShapingHandler.class));
            bind(MetricsHolder.class).toInstance(metricsHolder);
            bind(PublishPayloadPersistence.class).toInstance(mock(PublishPayloadPersistence.class));
            bind(ClientSessionPersistence.class).toInstance(mock(ClientSessionPersistence.class));
            bind(PublishDistributor.class).toInstance(mock(PublishDistributor.class));
            bind(LocalTopicTree.class).toInstance(mock(TopicTreeImpl.class));
            bind(IncomingPublishService.class).toInstance(mock(IncomingPublishService.class));
            bind(RetainedMessagePersistence.class).toInstance(mock(RetainedMessagePersistence.class));
            bind(ListeningExecutorService.class).annotatedWith(Persistence.class).toInstance(mock(ListeningExecutorService.class));
            bind(InternalPublishService.class).toInstance(mock(InternalPublishService.class));
            bind(ClientSessionSubscriptionPersistence.class).toInstance(mock(ClientSessionSubscriptionPersistence.class));
            bind(ListenerConfigurationService.class).toInstance(mock(ListenerConfigurationService.class));
            bind(OpenConnectionsGauge.class).toInstance(mock(OpenConnectionsGauge.class));
            bindScope(LazySingleton.class, LazySingletonScope.get());
        }
    });
}
 
Example #18
Source File: ChannelDependencies.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@NotNull
public GlobalTrafficShapingHandler getGlobalTrafficShapingHandler() {
    return globalTrafficShapingHandler;
}
 
Example #19
Source File: ChannelDependencies.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@Inject
public ChannelDependencies(
        @NotNull final Provider<MetricsInitializer> statisticsInitializer,
        @NotNull final NoConnectIdleHandler noConnectIdleHandler,
        @NotNull final Provider<ConnectHandler> connectHandlerProvider,
        @NotNull final ConnectionLimiterHandler connectionLimiterHandler,
        @NotNull final ConnectPersistenceUpdateHandler connectPersistenceUpdateHandler,
        @NotNull final DisconnectHandler disconnectHandler,
        @NotNull final Provider<SubscribeHandler> subscribeHandlerProvider,
        @NotNull final Provider<PublishUserEventReceivedHandler> publishUserEventReceivedHandlerProvider,
        @NotNull final Provider<UnsubscribeHandler> unsubscribeHandlerProvider,
        @NotNull final Provider<QoSReceiverHandler> qoSReceiverHandlerProvider,
        @NotNull final Provider<QoSSenderHandler> qoSSenderHandlerProvider,
        @NotNull final ChannelGroup channelGroup,
        @NotNull final FullConfigurationService fullConfigurationService,
        @NotNull final GlobalTrafficShapingHandler globalTrafficShapingHandler,
        @NotNull final MetricsHolder metricsHolder,
        @NotNull final ExceptionHandler exceptionHandler,
        @NotNull final PingRequestHandler pingRequestHandler,
        @NotNull final RestrictionsConfigurationService restrictionsConfigurationService,
        @NotNull final MqttConnectDecoder mqttConnectDecoder,
        @NotNull final ReturnMessageIdToPoolHandler returnMessageIdToPoolHandler,
        @NotNull final Provider<DropOutgoingPublishesHandler> dropOutgoingPublishesHandlerProvider,
        @NotNull final EventLog eventLog,
        @NotNull final SslParameterHandler sslParameterHandler,
        @NotNull final MqttDecoders mqttDecoders,
        @NotNull final EncoderFactory encoderFactory,
        @NotNull final Provider<AuthHandler> authHandlerProvider,
        @NotNull final AuthInProgressMessageHandler authInProgressMessageHandler,
        @NotNull final Provider<PluginInitializerHandler> pluginInitializerHandlerProvider,
        @NotNull final Provider<ClientLifecycleEventHandler> clientLifecycleEventHandlerProvider,
        @NotNull final Provider<IncomingPublishHandler> incomingPublishHandlerProvider,
        @NotNull final Provider<IncomingSubscribeHandler> incomingSubscribeHandlerProvider,
        @NotNull final Provider<MessageExpiryHandler> publishMessageExpiryHandlerProvider,
        @NotNull final PublishOutboundInterceptorHandler publishOutboundInterceptorHandler,
        @NotNull final ConnectInboundInterceptorHandler connectInboundInterceptorHandler,
        @NotNull final ConnackOutboundInterceptorHandler connackOutboundInterceptorHandler,
        @NotNull final DisconnectInterceptorHandler disconnectInterceptorHandler,
        @NotNull final PubackInterceptorHandler pubackInterceptorHandler,
        @NotNull final PubrecInterceptorHandler pubrecInterceptorHandler,
        @NotNull final PubrelInterceptorHandler pubrelInterceptorHandler,
        @NotNull final PubcompInterceptorHandler pubcompInterceptorHandler,
        @NotNull final SubackOutboundInterceptorHandler subAckOutboundInterceptorHandler,
        @NotNull final UnsubackOutboundInterceptorHandler unsubackOutboundInterceptorHandler,
        @NotNull final UnsubscribeInboundInterceptorHandler unsubscribeInboundInterceptorHandler,
        @NotNull final PingInterceptorHandler pingInterceptorHandler) {

    this.statisticsInitializer = statisticsInitializer;
    this.noConnectIdleHandler = noConnectIdleHandler;
    this.connectHandlerProvider = connectHandlerProvider;
    this.connectionLimiterHandler = connectionLimiterHandler;
    this.connectPersistenceUpdateHandler = connectPersistenceUpdateHandler;
    this.disconnectHandler = disconnectHandler;
    this.subscribeHandlerProvider = subscribeHandlerProvider;
    this.publishUserEventReceivedHandlerProvider = publishUserEventReceivedHandlerProvider;
    this.unsubscribeHandlerProvider = unsubscribeHandlerProvider;
    this.qoSReceiverHandlerProvider = qoSReceiverHandlerProvider;
    this.qoSSenderHandlerProvider = qoSSenderHandlerProvider;
    this.channelGroup = channelGroup;
    this.fullConfigurationService = fullConfigurationService;
    this.globalTrafficShapingHandler = globalTrafficShapingHandler;
    this.metricsHolder = metricsHolder;
    this.exceptionHandler = exceptionHandler;
    this.pingRequestHandler = pingRequestHandler;
    this.restrictionsConfigurationService = restrictionsConfigurationService;
    this.mqttConnectDecoder = mqttConnectDecoder;
    this.returnMessageIdToPoolHandler = returnMessageIdToPoolHandler;
    this.mqttMessageEncoder = new MQTTMessageEncoder(encoderFactory);
    this.dropOutgoingPublishesHandlerProvider = dropOutgoingPublishesHandlerProvider;
    this.eventLog = eventLog;
    this.sslParameterHandler = sslParameterHandler;
    this.mqttDecoders = mqttDecoders;
    this.authHandlerProvider = authHandlerProvider;
    this.authInProgressMessageHandler = authInProgressMessageHandler;
    this.pluginInitializerHandlerProvider = pluginInitializerHandlerProvider;
    this.clientLifecycleEventHandlerProvider = clientLifecycleEventHandlerProvider;
    this.incomingPublishHandlerProvider = incomingPublishHandlerProvider;
    this.incomingSubscribeHandlerProvider = incomingSubscribeHandlerProvider;
    this.publishMessageExpiryHandlerProvider = publishMessageExpiryHandlerProvider;
    this.publishOutboundInterceptorHandler = publishOutboundInterceptorHandler;
    this.connectInboundInterceptorHandler = connectInboundInterceptorHandler;
    this.connackOutboundInterceptorHandler = connackOutboundInterceptorHandler;
    this.disconnectInterceptorHandler = disconnectInterceptorHandler;
    this.pubackInterceptorHandler = pubackInterceptorHandler;
    this.pubrecInterceptorHandler = pubrecInterceptorHandler;
    this.pubrelInterceptorHandler = pubrelInterceptorHandler;
    this.pubcompInterceptorhandler = pubcompInterceptorHandler;
    this.subAckOutboundInterceptorHandler = subAckOutboundInterceptorHandler;
    this.unsubackOutboundInterceptorHandler = unsubackOutboundInterceptorHandler;
    this.unsubscribeInboundInterceptorHandler = unsubscribeInboundInterceptorHandler;
    this.pingInterceptorHandler = pingInterceptorHandler;
}
 
Example #20
Source File: SocksServerInitializer.java    From NSS with Apache License 2.0 4 votes vote down vote up
public SocksServerInitializer(Config config,
		GlobalTrafficShapingHandler trafficHandler) {
	this.trafficHandler = trafficHandler;
	socksMessageEncoder = new SocksMessageEncoder();
	socksServerHandler = new SocksServerHandler(config);
}
 
Example #21
Source File: ThrottlingModule.java    From hivemq-community-edition with Apache License 2.0 4 votes vote down vote up
@Override
protected void configure() {

    bind(GlobalTrafficShapingHandler.class).toProvider(GlobalTrafficShapingProvider.class).in(Singleton.class);
}