Example usage for io.netty.channel.socket.nio NioSocketChannel NioSocketChannel

List of usage examples for io.netty.channel.socket.nio NioSocketChannel NioSocketChannel

Introduction

In this page you can find the example usage for io.netty.channel.socket.nio NioSocketChannel NioSocketChannel.

Prototype

public NioSocketChannel() 

Source Link

Document

Create a new instance

Usage

From source file:io.grpc.netty.UtilsTest.java

License:Apache License

@Test
public void channelOptionsTest_nio() {
    Channel channel = new NioSocketChannel();
    SocketOptions socketOptions = setAndValidateGeneric(channel);
    assertNull(socketOptions.soTimeoutMillis);
}

From source file:org.asynchttpclient.netty.channel.NioSocketChannelFactory.java

License:Open Source License

@Override
public NioSocketChannel newChannel() {
    return new NioSocketChannel();
}

From source file:org.jupiter.transport.netty.TcpChannelProvider.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/*  w w w  .  ja va  2s. c  o  m*/
public T newChannel() {
    switch (kindChannel) {
    case ACCEPTOR:
        switch (typeIO) {
        case NIO:
            return (T) new NioServerSocketChannel();
        case NATIVE:
            return (T) new EpollServerSocketChannel();
        default:
            throw new IllegalStateException("invalid type IO: " + typeIO);
        }
    case CONNECTOR:
        switch (typeIO) {
        case NIO:
            return (T) new NioSocketChannel();
        case NATIVE:
            return (T) new EpollSocketChannel();
        default:
            throw new IllegalStateException("invalid type IO: " + typeIO);
        }
    default:
        throw new IllegalStateException("invalid kind channel: " + kindChannel);
    }
}

From source file:sas.systems.imflux.session.rtsp.SimpleRtspSession.java

License:Apache License

/**
 * {@inheritDoc}/*from   ww  w . j a v a 2  s.c om*/
 */
@Override
public boolean sendRequest(HttpRequest request, SocketAddress remoteAddress) {
    if (!this.running.get()) {
        return false;
    }

    // create channel and connect it to the given remote
    final Channel ch = new NioSocketChannel();
    final ChannelPipeline pipe = ch.pipeline();
    pipe.addLast("encoder", new RtspEncoder());
    pipe.addLast("decoder", new RtspDecoder());
    pipe.addLast("aggregator", new HttpObjectAggregator(64 * 1024));
    pipe.addLast("handler", new RtspHandler(SimpleRtspSession.this));
    this.workerGroup.register(ch);

    ch.connect(remoteAddress).syncUninterruptibly();

    return internalSend(request, ch);
}