Java 类org.jboss.netty.channel.ChannelPipelineException 实例源码

项目:httptunnel    文件:HttpTunnelServerChannel.java   
public HttpTunnelAcceptedChannel createTunnel(InetSocketAddress remoteAddress) {
    final TunnelIdGenerator tunnelIdGenerator = config.getTunnelIdGenerator();

    final ChannelPipeline childPipeline;

    try {
        childPipeline = config.getPipelineFactory().getPipeline();
    }
    catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }

    final String tunnelId = String.format("%s_%s", tunnelIdPrefix, tunnelIdGenerator.generateId());
    final HttpTunnelAcceptedChannel tunnel = new HttpTunnelAcceptedChannel(this, this.getFactory(), childPipeline, new HttpTunnelAcceptedChannelSink(), remoteAddress, tunnelId);

    tunnels.put(tunnelId, tunnel);

    Channels.fireChannelOpen(tunnel);
    Channels.fireChannelBound(tunnel, this.getLocalAddress());
    Channels.fireChannelConnected(tunnel, remoteAddress);

    return tunnel;
}
项目:apm-agent    文件:PinpointSocketFactory.java   
public ChannelFuture reconnect(final SocketAddress remoteAddress) {
    if (remoteAddress == null) {
        throw new NullPointerException("remoteAddress");
    }

    ChannelPipeline pipeline;
    final ClientBootstrap bootstrap = this.bootstrap;
    try {
        pipeline = bootstrap.getPipelineFactory().getPipeline();
    } catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }
    SocketHandler socketHandler = (PinpointSocketHandler) pipeline.getLast();
    socketHandler.initReconnect();


    // Set the options.
    Channel ch = bootstrap.getFactory().newChannel(pipeline);
    boolean success = false;
    try {
        ch.getConfig().setOptions(bootstrap.getOptions());
        success = true;
    } finally {
        if (!success) {
            ch.close();
        }
    }

    // Connect.
    return ch.connect(remoteAddress);
}
项目:pinpoint    文件:DefaultPinpointClientFactory.java   
public ChannelFuture reconnect(final SocketAddress remoteAddress) {
    if (remoteAddress == null) {
        throw new NullPointerException("remoteAddress");
    }

    ChannelPipeline pipeline;
    final ClientBootstrap bootstrap = this.bootstrap;
    try {
        pipeline = bootstrap.getPipelineFactory().getPipeline();
    } catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }
    PinpointClientHandler pinpointClientHandler = (DefaultPinpointClientHandler) pipeline.getLast();
    pinpointClientHandler.initReconnect();


    // Set the options.
    Channel ch = bootstrap.getFactory().newChannel(pipeline);
    boolean success = false;
    try {
        ch.getConfig().setOptions(bootstrap.getOptions());
        success = true;
    } finally {
        if (!success) {
            ch.close();
        }
    }

    // Connect.
    return ch.connect(remoteAddress);
}
项目:android-netty    文件:ClientBootstrap.java   
/**
 * Attempts a new connection with the specified {@code remoteAddress} and
 * the specified {@code localAddress}.  If the specified local address is
 * {@code null}, the local address of a new channel is determined
 * automatically.
 *
 * @return a future object which notifies when this connection attempt
 *         succeeds or fails
 *
 * @throws ChannelPipelineException
 *         if this bootstrap's {@link #setPipelineFactory(ChannelPipelineFactory) pipelineFactory}
 *            failed to create a new {@link ChannelPipeline}
 */
public ChannelFuture connect(final SocketAddress remoteAddress, final SocketAddress localAddress) {

    if (remoteAddress == null) {
        throw new NullPointerException("remoteAddress");
    }

    ChannelPipeline pipeline;
    try {
        pipeline = getPipelineFactory().getPipeline();
    } catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }

    // Set the options.
    Channel ch = getFactory().newChannel(pipeline);
    boolean success = false;
    try {
        ch.getConfig().setOptions(getOptions());
        success = true;
    } finally {
        if (!success) {
            ch.close();
        }
    }

    // Bind.
    if (localAddress != null) {
        ch.bind(localAddress);
    }

    // Connect.
    return ch.connect(remoteAddress);
}
项目:httptunnel    文件:HttpTunnelServerChannel.java   
private ChannelPipeline createRealPipeline(ChannelGroup realConnections) {
    final ChannelPipelineFactory realPipelineFactory = new HttpTunnelAcceptedChannelPipelineFactory(this);

    final ChannelPipeline pipeline;
    try {
        pipeline = realPipelineFactory.getPipeline();
    }
    catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }

    pipeline.addFirst(HttpTunnelServerChannelHandler.NAME, new HttpTunnelServerChannelHandler(this, realPipelineFactory, realConnections));

    return pipeline;
}