48
48
49
49
import java .io .EOFException ;
50
50
import java .io .IOException ;
51
+ import java .net .InetAddress ;
52
+ import java .net .InetSocketAddress ;
51
53
import java .time .ZoneId ;
52
54
import java .util .ArrayList ;
53
55
import java .util .Collections ;
@@ -311,6 +313,7 @@ public void testSimpleStreams() throws Exception {
311
313
float [] floatArray = { 1.1f , 2.2f , 3.3f };
312
314
out .writeGenericValue (floatArray );
313
315
double [] doubleArray = { 1.1 , 2.2 , 3.3 };
316
+ InetSocketAddress inetSocketAddress = new InetSocketAddress (InetAddress .getLocalHost (), 80 );
314
317
out .writeGenericValue (doubleArray );
315
318
out .writeString ("hello" );
316
319
out .writeString ("goodbye" );
@@ -324,6 +327,7 @@ public void testSimpleStreams() throws Exception {
324
327
out .writeOptionalTimeZone (DateTimeZone .getDefault ());
325
328
out .writeOptionalTimeZone (null );
326
329
out .writeGenericValue (new DateTime (123456 , DateTimeZone .forID ("America/Los_Angeles" )));
330
+ out .writeGenericValue (inetSocketAddress );
327
331
final byte [] bytes = BytesReference .toBytes (out .bytes ());
328
332
StreamInput in = StreamInput .wrap (BytesReference .toBytes (out .bytes ()));
329
333
assertEquals (in .available (), bytes .length );
@@ -361,6 +365,7 @@ public void testSimpleStreams() throws Exception {
361
365
JodaCompatibleZonedDateTime jdt = (JodaCompatibleZonedDateTime ) dt ;
362
366
assertThat (jdt .getZonedDateTime ().toInstant ().toEpochMilli (), equalTo (123456L ));
363
367
assertThat (jdt .getZonedDateTime ().getZone (), equalTo (ZoneId .of ("America/Los_Angeles" )));
368
+ assertEquals (inetSocketAddress , in .readGenericValue ());
364
369
assertEquals (0 , in .available ());
365
370
IllegalArgumentException ex = expectThrows (IllegalArgumentException .class , () -> out .writeGenericValue (new Object () {
366
371
@ Override
0 commit comments