Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetURIWithLocalHost()
        public virtual void TestGetURIWithLocalHost()
        {
            NetworkReceiver networkReceiver = new NetworkReceiver(mock(typeof(NetworkReceiver.Monitor)), mock(typeof(NetworkReceiver.Configuration)), mock(typeof(LogProvider)));

            // We should NOT do a reverse DNS lookup for hostname. It might not be routed properly.
            URI uri = networkReceiver.GetURI(new InetSocketAddress("localhost", PORT));

            assertEquals("Uri host is not localhost ip: " + uri.Host, "127.0.0.1", uri.Host);
            assertEquals(PORT, uri.Port);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetURIWithWildCard()
        public virtual void TestGetURIWithWildCard()
        {
            NetworkReceiver networkReceiver = new NetworkReceiver(mock(typeof(NetworkReceiver.Monitor)), mock(typeof(NetworkReceiver.Configuration)), mock(typeof(LogProvider)));

            // Wildcard should not be resolved here
            const string wildCard = "0.0.0.0";
            URI          uri      = networkReceiver.GetURI(new InetSocketAddress(wildCard, PORT));

            assertEquals(wildCard + " does not match Uri host: " + uri.Host, wildCard, uri.Host);
            assertEquals(PORT, uri.Port);
        }