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

项目:httptunnel    文件:HttpTunnelServerChannel.java   
protected HttpTunnelServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, ServerSocketChannelFactory inboundFactory, ChannelGroup realConnections) {
    super(factory, pipeline, sink);

    tunnelIdPrefix = Long.toHexString(random.nextLong());
    tunnels = new ConcurrentHashMap<String, HttpTunnelAcceptedChannel>();

    config = new HttpTunnelServerChannelConfig();
    realChannel = inboundFactory.newChannel(this.createRealPipeline(realConnections));
    config.setRealChannel(realChannel);

    opened = new AtomicBoolean(true);
    bindState = new AtomicReference<BindState>(BindState.UNBOUND);

    realConnections.add(realChannel);

    Channels.fireChannelOpen(this);
}
项目:android-netty    文件:NioSocketChannel.java   
public NioSocketChannel(
        Channel parent, ChannelFactory factory,
        ChannelPipeline pipeline, ChannelSink sink,
        SocketChannel socket, NioWorker worker) {
    super(parent, factory, pipeline, sink, worker, socket);
    config = new DefaultNioSocketChannelConfig(socket.socket());
}
项目:android-netty    文件:NioClientSocketChannel.java   
NioClientSocketChannel(
        ChannelFactory factory, ChannelPipeline pipeline,
        ChannelSink sink, NioWorker worker) {

    super(null, factory, pipeline, sink, newSocket(), worker);
    fireChannelOpen(this);
}
项目:android-netty    文件:AbstractNioChannel.java   
protected AbstractNioChannel(
        Integer id, Channel parent, ChannelFactory factory, ChannelPipeline pipeline,
        ChannelSink sink, AbstractNioWorker worker, C ch) {
    super(id, parent, factory, pipeline, sink);
    this.worker = worker;
    channel = ch;
}
项目:android-netty    文件:AbstractNioChannel.java   
protected AbstractNioChannel(
        Channel parent, ChannelFactory factory,
        ChannelPipeline pipeline, ChannelSink sink, AbstractNioWorker worker, C ch)  {
    super(parent, factory, pipeline, sink);
    this.worker = worker;
    channel = ch;
}
项目:httptunnel    文件:HttpTunnelAcceptedChannel.java   
protected HttpTunnelAcceptedChannel(HttpTunnelServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, InetSocketAddress remoteAddress, String tunnelId) {
    super(parent, factory, pipeline, sink);

    this.parent = parent;
    this.remoteAddress = remoteAddress;
    this.tunnelId = tunnelId;

    localAddress = parent.getLocalAddress();
    config = new HttpTunnelAcceptedChannelConfig();

    saturationManager = new SaturationManager(config.getWriteBufferLowWaterMark(), config.getWriteBufferHighWaterMark());

    opened = new AtomicBoolean(true);

    pollChannel = new AtomicReference<Channel>(null);
    queuedResponses = new ConcurrentLinkedQueue<QueuedResponse>();

    incomingBuffer = new IncomingBuffer<ChannelBuffer>(this);

    Metrics.newGauge(HttpTunnelAcceptedChannel.class, "incomingBuffer", new Gauge<Integer>() {
        @Override
        public Integer value() {
            return incomingBuffer.size();
        }
    });

    pingExecutor = Executors.newSingleThreadScheduledExecutor();
    pingResponder = new PingResponder();
    pingTimeout = new PingTimeout();
    pingLock = new Object();
    pingTimeoutFuture = null;
}
项目:httptunnel    文件:FakeServerSocketChannel.java   
public FakeSocketChannel acceptNewConnection(
        InetSocketAddress remoteAddress, ChannelSink sink) throws Exception {
    ChannelPipeline newPipeline = getConfig().getPipelineFactory()
            .getPipeline();
    FakeSocketChannel newChannel = new FakeSocketChannel(this,
            getFactory(), newPipeline, sink);
    newChannel.localAddress = localAddress;
    newChannel.remoteAddress = remoteAddress;
    fireChannelOpen(newChannel);
    fireChannelBound(newChannel, newChannel.localAddress);
    fireChannelConnected(this, newChannel.remoteAddress);

    return newChannel;
}
项目:netty-isdn-transport    文件:IsdnAcceptedChannel.java   
public IsdnAcceptedChannel(
        IsdnServerChannel parent,
        ChannelFactory factory,
        ChannelPipeline pipeline,
        ChannelSink sink,
        IsdnSocketAddress calling,
        IsdnSocketAddress called,
        PlciConnectionHandler conn) {


    super(parent, factory, pipeline, sink);

    if (parent == null) {
        throw new NullPointerException("parent");
    }
    if (calling == null) {
        throw new NullPointerException("callingAddress");
    }
    if (called == null) {
        throw new NullPointerException("calledAddress");
    }

    this.parent = parent;
    this.config = new IsdnChannelConfig();
    this.callingAddress = calling;
    this.calledAddress = called;
    this.plciHandler = conn;

    this.worker = new IsdnAcceptedWorker(this);

    setupConfig(parent.getConfig());

    // let isdn server channel pipeline factory to create StateMachine
    // handler based on the protocol for accepted channels (incoming
    // connection)
    pipeline.addFirst("IsdnAcceptedChannelStateMachine", getAcceptedChannelStateMachineHandler(this,
            "IsdnAcceptedChannelStateMachine"));

    fireChannelOpen(this);
    fireChannelBound(this, getLocalAddress());
    fireChannelConnected(this, getRemoteAddress());
}
项目:httptunnel    文件:FakeServerSocketChannel.java   
public FakeServerSocketChannel(ChannelFactory factory,
        ChannelPipeline pipeline, ChannelSink sink) {
    super(null, factory, pipeline, sink);
}
项目:httptunnel    文件:FakeSocketChannel.java   
public FakeSocketChannel(Channel parent, ChannelFactory factory,
        ChannelPipeline pipeline, ChannelSink sink) {
    super(parent, factory, pipeline, sink);
    this.sink = sink;
}