Java Code Examples for org.jboss.netty.channel.Channel.getRemoteAddress()

The following are Jave code examples for showing how to use getRemoteAddress() of the org.jboss.netty.channel.Channel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: athena   File: AbstractOpenFlowSwitch.java   Source Code and License Vote up 5 votes
@Override
public final void setChannel(Channel channel) {
    this.channel = channel;
    final SocketAddress address = channel.getRemoteAddress();
    if (address instanceof InetSocketAddress) {
        final InetSocketAddress inetAddress = (InetSocketAddress) address;
        final IpAddress ipAddress = IpAddress.valueOf(inetAddress.getAddress());
        if (ipAddress.isIp4()) {
            channelId = ipAddress.toString() + ':' + inetAddress.getPort();
        } else {
            channelId = '[' + ipAddress.toString() + "]:" + inetAddress.getPort();
        }
    }
}
 
Example 2
Project: athena   File: PcepClientImpl.java   Source Code and License Vote up 5 votes
@Override
public final void setChannel(Channel channel) {
    this.channel = channel;
    final SocketAddress address = channel.getRemoteAddress();
    if (address instanceof InetSocketAddress) {
        final InetSocketAddress inetAddress = (InetSocketAddress) address;
        final IpAddress ipAddress = IpAddress.valueOf(inetAddress.getAddress());
        if (ipAddress.isIp4()) {
            channelId = ipAddress.toString() + ':' + inetAddress.getPort();
        } else {
            channelId = '[' + ipAddress.toString() + "]:" + inetAddress.getPort();
        }
    }
}
 
Example 3
Project: athena   File: BgpPeerImpl.java   Source Code and License Vote up 5 votes
@Override
public final void setChannel(Channel channel) {
    this.channel = channel;
    final SocketAddress address = channel.getRemoteAddress();
    if (address instanceof InetSocketAddress) {
        final InetSocketAddress inetAddress = (InetSocketAddress) address;
        final IpAddress ipAddress = IpAddress.valueOf(inetAddress.getAddress());
        if (ipAddress.isIp4()) {
            channelId = ipAddress.toString() + ':' + inetAddress.getPort();
        } else {
            channelId = '[' + ipAddress.toString() + "]:" + inetAddress.getPort();
        }
    }
}
 
Example 4
Project: https-github.com-apache-zookeeper   File: ClientCnxnSocketNetty.java   Source Code and License Vote up 4 votes
@Override
SocketAddress getRemoteSocketAddress() {
    Channel copiedChanRef = channel;
    return (copiedChanRef == null) ? null : copiedChanRef.getRemoteAddress();
}