Package org.jboss.aerogear.simplepush.server

Examples of org.jboss.aerogear.simplepush.server.SimplePushServerConfig


    public static final String DEFAULT_HOST = "localhost";
    public static final int DEFAULT_PORT = 7777;

    @Override
    public void start() {
        final SimplePushServerConfig config = fromConfig(container.config());
        final DataStore datastore = new InMemoryDataStore();
        final byte[] privateKey = DefaultSimplePushServer.generateAndStorePrivateKey(datastore, config);
        final SimplePushServer simplePushServer = new DefaultSimplePushServer(datastore, config, privateKey);
        final HttpServer httpServer = vertx.createHttpServer();
        setupHttpNotificationHandler(httpServer, simplePushServer);
View Full Code Here


                simplePushConfig.endpointPort(notificationSocketBinding.getPort());
            }

            final DefaultEventExecutorGroup reaperExcutorGroup = new DefaultEventExecutorGroup(1);
            final DataStore datastore = injectedDataStore.getValue();
            final SimplePushServerConfig simplePushServerConfig = simplePushConfig.build();
            final ServerBootstrap serverBootstrap = new ServerBootstrap()
                .group(new NioEventLoopGroup(), new NioEventLoopGroup())
                .channel(NioServerSocketChannel.class)
                .childHandler(new SockJSChannelInitializer(simplePushServerConfig, datastore, sockJsConfig, reaperExcutorGroup));
View Full Code Here

                simplePushConfig.endpointPort(notificationSocketBinding.getPort());
            }

            final DefaultEventExecutorGroup reaperExcutorGroup = new DefaultEventExecutorGroup(1);
            final DataStore datastore = injectedDataStore.getValue();
            final SimplePushServerConfig simplePushServerConfig = simplePushConfig.build();
            final ServerBootstrap serverBootstrap = new ServerBootstrap()
                .group(new NioEventLoopGroup(), new NioEventLoopGroup())
                .channel(NioServerSocketChannel.class)
                .childHandler(new SockJSChannelInitializer(simplePushServerConfig, datastore, sockJsConfig, reaperExcutorGroup));
View Full Code Here

    @Override
    public void handlerAdded(final ChannelHandlerContext ctx) throws Exception {
        if (started()) {
            return;
        }
        final SimplePushServerConfig config = simplePushServer.config();
        logger.info("Creating UserAgentReaper job : " + config.userAgentReaperTimeout());
        scheduleFuture = ctx.executor().scheduleAtFixedRate(new UserAgentReaper(simplePushServer),
                config.userAgentReaperTimeout(),
                config.userAgentReaperTimeout(),
                TimeUnit.MILLISECONDS);
        reaperStarted.set(true);
    }
View Full Code Here

    @BeforeClass
    public static void startSimplePushServer() throws Exception {
        final SockJsConfig sockJSConfig = SockJsConfig.withPrefix("/simplepush").cookiesNeeded().build();
        final DataStore datastore = new InMemoryDataStore();
        final ServerBootstrap sb = new ServerBootstrap();
        final SimplePushServerConfig simplePushConfig = DefaultSimplePushConfig.create()
                .userAgentReaperTimeout(2000L)
                .password("test")
                .build();
        sb.group(bossGroup, workerGroup)
                .channel(NioServerSocketChannel.class)
View Full Code Here

    public void run() throws Exception {
        final EventLoopGroup bossGroup = new NioEventLoopGroup();
        final EventLoopGroup workerGroup = new NioEventLoopGroup();
        final DefaultEventExecutorGroup reaperExcutorGroup = new DefaultEventExecutorGroup(1);
        final SimplePushServerConfig simplePushConfig = config.simplePushServerConfig();
        try {
            final ServerBootstrap sb = new ServerBootstrap();
            sb.group(bossGroup, workerGroup)
                    .channel(NioServerSocketChannel.class)
                    .childHandler(new SockJSChannelInitializer(simplePushConfig, config.dataStore(), config.sockJsConfig(), reaperExcutorGroup));
            final Channel ch = sb.bind(simplePushConfig.host(), simplePushConfig.port()).sync().channel();
            logger.info("Server started");
            logger.debug(config.toString());
            ch.closeFuture().sync();
        } finally {
            bossGroup.shutdownGracefully();
View Full Code Here

public class DefaultSimplePushConfigTest {

    @Test
    public void buildConfig() {
        final SimplePushServerConfig config = DefaultSimplePushConfig.create()
                .userAgentReaperTimeout(1000L)
                .ackInterval(60000L)
                .password("test")
                .build();
        assertThat(config.endpointUrl(), equalTo("http://127.0.0.1:7777/update"));
        assertThat(config.endpointPrefix(), equalTo("/update"));
        assertThat(config.userAgentReaperTimeout(), is(1000L));
        assertThat(config.acknowledmentInterval(), is(60000L));
    }
View Full Code Here

        assertThat(config.acknowledmentInterval(), is(60000L));
    }

    @Test
    public void buildConfigWithNullUserAgentReaperTimeout() {
        final SimplePushServerConfig config = DefaultSimplePushConfig.create().userAgentReaperTimeout(null)
                .password("test")
                .build();
        assertThat(config.userAgentReaperTimeout(), is(604800000L));
    }
View Full Code Here

        assertThat(config.userAgentReaperTimeout(), is(604800000L));
    }

    @Test
    public void buildConfigWithNullAckInterval() {
        final SimplePushServerConfig config = DefaultSimplePushConfig.create().ackInterval(null)
                .password("test")
                .build();
        assertThat(config.acknowledmentInterval(), is(60000L));
    }
View Full Code Here

        executorService.execute(reaper);
        executorService.awaitTermination(500, TimeUnit.MILLISECONDS);
    }

    private SimplePushServer simplePushServer() {
        final SimplePushServerConfig config = DefaultSimplePushConfig.create()
                .userAgentReaperTimeout(20L)
                .password("test")
                .build();
        final DataStore store = new InMemoryDataStore();
        final byte[] privateKey = DefaultSimplePushServer.generateAndStorePrivateKey(store, config);
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.simplepush.server.SimplePushServerConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.