code polish

connection_type_change
Robinson 2021-04-08 20:04:13 +02:00
parent e4a0522093
commit 9a8b5aa364
3 changed files with 21 additions and 8 deletions

View File

@ -21,7 +21,7 @@ Maven Info
<dependency>
<groupId>com.dorkbox</groupId>
<artifactId>NetworkUtils</artifactId>
<version>2.3</version>
<version>2.3</version>
</dependency>
</dependencies>
```
@ -30,11 +30,12 @@ Gradle Info
```
dependencies {
...
compile 'com.dorkbox:NetworkUtils:2.3'
implementation("com.dorkbox:NetworkUtils:2.3")
}
```
License
---------
This project is © 2014 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.
This project is © 2021 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further
references.

View File

@ -20,29 +20,29 @@ import org.junit.Test
class DnsTest {
@Test
fun testLanAddress() {
fun lanAddress() {
Assert.assertNotNull(IP.lanAddress())
}
@Test
fun testPublicViaHttpAddress() {
fun publicViaHttpAddress() {
val publicIpViaHttp = IP.publicIpViaHttp()
Assert.assertNotNull(publicIpViaHttp)
// println(IP.fromString(publicIpViaHttp!!))
}
@Test
fun testDnsNameServers() {
fun dnsNameServers() {
Assert.assertTrue(Dns.defaultNameServers.isNotEmpty())
}
@Test
fun testDnsNdots() {
fun dnsNdots() {
Assert.assertTrue(Dns.numberDots >= 1)
}
@Test
fun testLocalhost() {
fun localhost() {
Assert.assertNotNull(IP.LOCALHOST)
}
}

View File

@ -581,6 +581,18 @@ class IpValidationTests {
}
}
@Test
fun testAddressLength() {
Assert.assertEquals(4, IPv4.length)
Assert.assertEquals(16, IPv6.length)
}
@Test
fun testFamilyOf() {
Assert.assertTrue(IPv4.isFamily(InetAddress.getByName("192.168.0.1")))
Assert.assertTrue(IPv6.isFamily(InetAddress.getByName("1:2:3:4:5:6:7:8")))
}
@Test
fun testLocalhost() {
Assert.assertNotNull(IP.LOCALHOST)