Skip to content

Commit

Permalink
#336 Adds prefab value for InetSocketAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Ouwens authored and Jan Ouwens committed Aug 20, 2020
1 parent 2e549cb commit 86935e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.lang.reflect.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.InetSocketAddress;
import java.net.URI;
import java.nio.*;
import java.text.DateFormat;
Expand Down Expand Up @@ -262,6 +263,11 @@ private void addUncommonClasses() {
new java.sql.Timestamp(1337));

addValues(EventObject.class, new EventObject(1), new EventObject(2), new EventObject(1));
addValues(
InetSocketAddress.class,
InetSocketAddress.createUnresolved("localhost", 8080),
InetSocketAddress.createUnresolved("127.0.0.1", 8080),
InetSocketAddress.createUnresolved("localhost", 8080));

// Constructing InetAddress reflectively, because it might throw an awkward exception
// otherwise.
Expand All @@ -275,14 +281,14 @@ private void addUncommonClasses() {
inetAddress.callFactory("getByName", classes(String.class), objects("127.0.0.1")));
addValues(
inet4Address.resolve(),
inetAddress.callFactory("getByName", classes(String.class), objects("127.0.0.1")),
inetAddress.callFactory("getByName", classes(String.class), objects("127.0.0.42")),
inetAddress.callFactory("getByName", classes(String.class), objects("127.0.0.1")));
inet4Address.callFactory("getByName", classes(String.class), objects("127.0.0.1")),
inet4Address.callFactory("getByName", classes(String.class), objects("127.0.0.42")),
inet4Address.callFactory("getByName", classes(String.class), objects("127.0.0.1")));
addValues(
inet6Address.resolve(),
inetAddress.callFactory("getByName", classes(String.class), objects("::1")),
inetAddress.callFactory("getByName", classes(String.class), objects("::")),
inetAddress.callFactory("getByName", classes(String.class), objects("::1")));
inet6Address.callFactory("getByName", classes(String.class), objects("::1")),
inet6Address.callFactory("getByName", classes(String.class), objects("::")),
inet6Address.callFactory("getByName", classes(String.class), objects("::1")));
}

@SuppressWarnings({"unchecked", "rawtypes"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.URI;
import java.net.*;
import java.nio.*;
import java.text.SimpleDateFormat;
import java.time.*;
Expand Down Expand Up @@ -417,6 +414,7 @@ static final class CommonClassesContainer {
private final InetAddress inetAddress;
private final Inet4Address inet4Address;
private final Inet6Address inet6Address;
private final InetSocketAddress inetSocketAddress;
private final Thread thread;
private final java.sql.Date sqlDate;
private final java.sql.Time sqlTime;
Expand All @@ -439,6 +437,7 @@ public CommonClassesContainer(
InetAddress inetAddress,
Inet4Address inet4Address,
Inet6Address inet6Address,
InetSocketAddress inetSocketAddress,
Thread thread,
java.sql.Date sqlDate,
java.sql.Time sqlTime,
Expand All @@ -459,6 +458,7 @@ public CommonClassesContainer(
this.inetAddress = inetAddress;
this.inet4Address = inet4Address;
this.inet6Address = inet6Address;
this.inetSocketAddress = inetSocketAddress;
this.thread = thread;
this.sqlDate = sqlDate;
this.sqlTime = sqlTime;
Expand Down

0 comments on commit 86935e9

Please sign in to comment.