File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import java .io .File ;
4
4
import java .net .InetAddress ;
5
+ import java .net .InetSocketAddress ;
6
+ import java .net .Socket ;
5
7
import java .nio .charset .Charset ;
6
8
import java .nio .charset .StandardCharsets ;
7
9
import java .security .KeyStore ;
10
+ import java .security .Security ;
8
11
import java .time .ZoneId ;
9
12
import java .util .Arrays ;
10
13
import java .util .HexFormat ;
@@ -93,5 +96,15 @@ public static void main(String[] args) throws Exception {
93
96
props .size ());
94
97
95
98
out .println (stats );
99
+
100
+ out .printf ("%n✧✧✧✧✧ Additional info in exception ✧✧✧✧✧%n" );
101
+ Security .setProperty ("jdk.includeInExceptions" , "hostInfo,jar" );
102
+ try (var s = new Socket ()) {
103
+ s .setSoTimeout (1_00 );
104
+ s .connect (new InetSocketAddress ("localhost" , 12345 ), 1_00 );
105
+ } catch (Exception e ) {
106
+ out .println (e .getMessage ());
107
+ assert e .getMessage ().contains ("localhost:12345" );
108
+ }
96
109
}
97
110
}
You can’t perform that action at this time.
0 commit comments