org.jboss.netty.channel.SimpleChannelHandler Java Examples

The following examples show how to use org.jboss.netty.channel.SimpleChannelHandler. 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: Connection.java    From pinpoint with Apache License 2.0 6 votes vote down vote up
void connect(SocketAddressProvider remoteAddressProvider, boolean reconnect, PipelineFactory pipelineFactory) {
    Assert.requireNonNull(remoteAddressProvider, "remoteAddress");

    final ChannelPipeline pipeline = pipelineFactory.newPipeline();

    Timer channelTimer = createTimer("Pinpoint-PinpointClientHandler-Timer");
    final ChannelHandler writeTimeout = new WriteTimeoutHandler(channelTimer, 3000, TimeUnit.MILLISECONDS);
    pipeline.addLast("writeTimeout", writeTimeout);

    this.pinpointClientHandler = this.clientHandlerFactory.newClientHandler(connectionFactory, remoteAddressProvider, channelTimer, reconnect);
    if (pinpointClientHandler instanceof SimpleChannelHandler) {
        pipeline.addLast("socketHandler", (SimpleChannelHandler) this.pinpointClientHandler);
    } else {
        throw new IllegalArgumentException("invalid pinpointClientHandler");
    }

    final SocketAddress remoteAddress = remoteAddressProvider.resolve();
    this.connectFuture  = connect0(remoteAddress, pipeline);
}