@Test public void testInsecureSource() { final InetSocketAddress remoteAddress = new InetSocketAddress("192.168.1.22", 2727); final InetSocketAddress unknownRemoteAddress = new InetSocketAddress("232.122.55.20", 2727); final Channel channel = Mockito.mock(Channel.class); final NetworkGuard guard = new DirectNetworkGuard(); Mockito.when(channel.isActive()).thenReturn(true); Mockito.when(channel.remoteAddress()).thenReturn(remoteAddress); final boolean secure = guard.isSecure(channel, unknownRemoteAddress); Assert.assertFalse(secure); }
@Override public boolean isSecure(Channel channel, InetSocketAddress source) { if (channel.isActive()) { return channel.remoteAddress().equals(source); } return false; }
DirectNetworkGuard implements NetworkGuard { @Override public boolean isSecure(Channel channel, InetSocketAddress source) { if (channel.isActive()) { return channel.remoteAddress().equals(source); } return false; } }
DirectNetworkGuard implements NetworkGuard { @Override public boolean isSecure(Channel channel, InetSocketAddress source) { if (channel.isActive()) { return channel.remoteAddress().equals(source); } return false; }  }
DirectNetworkGuard implements NetworkGuard { @Override public boolean isSecure(Channel channel, InetSocketAddress source) { if (channel.isActive()) { return channel.remoteAddress().equals(source); } return false; }  @Override boolean isSecure(Channel channel, InetSocketAddress source); }
DirectNetworkGuard implements NetworkGuard { @Override public boolean isSecure(Channel channel, InetSocketAddress source) { if (channel.isActive()) { return channel.remoteAddress().equals(source); } return false; }  @Override boolean isSecure(Channel channel, InetSocketAddress source);  }