类io.netty.channel.socket.DuplexChannel源码实例Demo

下面列出了怎么用io.netty.channel.socket.DuplexChannel的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: servicetalk   文件: RequestResponseCloseHandler.java
@Override
void closeChannelInbound(final Channel channel) {
    if (!has(state, IN_CLOSED)) {
        LOGGER.debug("{} Half-Closing INBOUND (reset)", channel);
        setSocketResetOnClose(channel);
        ((DuplexChannel) channel).shutdownInput().addListener((ChannelFutureListener) this::onHalfClosed);
    }
}
 
源代码2 项目: servicetalk   文件: RequestResponseCloseHandler.java
@Override
void closeChannelOutbound(final Channel channel) {
    if (!has(state, OUT_CLOSED)) {
        LOGGER.debug("{} Half-Closing OUTBOUND (reset)", channel);
        setSocketResetOnClose(channel);
        ((DuplexChannel) channel).shutdownOutput().addListener((ChannelFutureListener) this::onHalfClosed);
    }
}
 
源代码3 项目: servicetalk   文件: RequestResponseCloseHandler.java
private void clientHalfCloseOutbound(final Channel channel) {
    assert isClient;
    if (!has(state, OUT_CLOSED) && channel instanceof DuplexChannel) {
        LOGGER.debug("{} Half-Closing OUTBOUND", channel);
        state = unset(state, WRITE);
        ((DuplexChannel) channel).shutdownOutput().addListener((ChannelFutureListener) this::onHalfClosed);
    }
}
 
源代码4 项目: servicetalk   文件: RequestResponseCloseHandler.java
private void onHalfClosed(ChannelFuture future) {
    DuplexChannel dplxChannel = (DuplexChannel) future.channel();
    if (dplxChannel.isInputShutdown() && dplxChannel.isOutputShutdown()) {
        LOGGER.debug("{} Fully closing socket channel, both input and output shutdown", dplxChannel);
        closeChannel(dplxChannel, null);
    }
}
 
源代码5 项目: docker-java   文件: NettyDockerCmdExecFactory.java
private DuplexChannel connect() {
    try {
        return connect(bootstrap);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
}
 
源代码6 项目: docker-java   文件: NettyDockerCmdExecFactory.java
@Override
public DuplexChannel connect(Bootstrap bootstrap) throws InterruptedException {
    DockerClientConfig dockerClientConfig = getDockerClientConfig();
    String path = dockerClientConfig.getDockerHost().getPath();

    return (DuplexChannel) bootstrap.connect(new DomainSocketAddress(path)).sync().channel();
}
 
源代码7 项目: docker-java   文件: NettyDockerCmdExecFactory.java
@Override
public DuplexChannel connect(Bootstrap bootstrap) throws InterruptedException {
    DockerClientConfig dockerClientConfig = getDockerClientConfig();
    String host = dockerClientConfig.getDockerHost().getHost();
    int port = dockerClientConfig.getDockerHost().getPort();

    if (port == -1) {
        throw new RuntimeException("no port configured for " + host);
    }

    final DuplexChannel channel = (DuplexChannel) bootstrap.connect(host, port).sync().channel();

    final SslHandler ssl = initSsl(dockerClientConfig);

    if (ssl != null) {
        channel.pipeline().addFirst(ssl);

        // https://tools.ietf.org/html/rfc5246#section-7.2.1
        // TLS has its own special message about connection termination. Because TLS is a
        // session-level protocol, it can be covered by any transport-level protocol like
        // TCP, UTP and so on. But we know exactly that data being transferred over TCP and
        // that other side will never send any byte into this TCP connection, so this
        // channel should be closed.
        // RFC says that we must notify opposite side about closing. This could be done only
        // in sun.security.ssl.SSLEngineImpl and unfortunately it does not send this
        // message. On the other hand RFC does not enforce the opposite side to wait for
        // such message.
        ssl.sslCloseFuture().addListener(future -> channel.eventLoop().execute(channel::close));
    }

    return channel;
}
 
源代码8 项目: quarkus-http   文件: WebConnectionImpl.java
@Override
public void close() throws IOException {
    ((DuplexChannel) context.channel()).shutdownOutput();
}
 
源代码9 项目: quarkus-http   文件: WebConnectionImpl.java
@Override
public void close() throws IOException {
    ((DuplexChannel) context.channel()).shutdownOutput();
}
 
源代码10 项目: docker-java   文件: NettyInvocationBuilder.java
private DuplexChannel getChannel() {
    return channelProvider.getChannel();
}
 
源代码11 项目: docker-java   文件: NettyDockerCmdExecFactory.java
@Override
public DuplexChannel getChannel() {
    DuplexChannel channel = connect();
    channel.pipeline().addLast(new LoggingHandler(getClass()));
    return channel;
}
 
源代码12 项目: docker-java   文件: NettyDockerCmdExecFactory.java
private DuplexChannel connect(final Bootstrap bootstrap) throws InterruptedException {
    return nettyInitializer.connect(bootstrap);
}
 
源代码13 项目: docker-java   文件: ChannelProvider.java
DuplexChannel getChannel(); 
源代码14 项目: docker-java   文件: NettyDockerCmdExecFactory.java
DuplexChannel connect(final Bootstrap bootstrap) throws InterruptedException; 
 类所在包
 类方法
 同包方法