(Channel channel)
| 195 | } |
| 196 | |
| 197 | private static List<String> getLabelValues(Channel channel) { |
| 198 | String localAddress = ""; |
| 199 | String localPort = ""; |
| 200 | String peerAddress = ""; |
| 201 | String peerPort = ""; |
| 202 | |
| 203 | SocketAddress local = channel.localAddress(); |
| 204 | if (local instanceof InetSocketAddress) { |
| 205 | InetSocketAddress inetLocal = (InetSocketAddress) local; |
| 206 | if (inetLocal.getAddress() != null) { |
| 207 | localAddress = inetLocal.getAddress().getHostAddress(); |
| 208 | } else if (inetLocal.getHostString() != null) { |
| 209 | localAddress = inetLocal.getHostString(); |
| 210 | } |
| 211 | localPort = String.valueOf(inetLocal.getPort()); |
| 212 | } |
| 213 | |
| 214 | SocketAddress remote = channel.remoteAddress(); |
| 215 | if (remote instanceof InetSocketAddress) { |
| 216 | InetSocketAddress inetRemote = (InetSocketAddress) remote; |
| 217 | if (inetRemote.getAddress() != null) { |
| 218 | peerAddress = inetRemote.getAddress().getHostAddress(); |
| 219 | } else if (inetRemote.getHostString() != null) { |
| 220 | peerAddress = inetRemote.getHostString(); |
| 221 | } |
| 222 | peerPort = String.valueOf(inetRemote.getPort()); |
| 223 | } |
| 224 | |
| 225 | return Arrays.asList(localAddress, localPort, peerAddress, peerPort); |
| 226 | } |
| 227 | } |
no test coverage detected