File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/test/java/com/rabbitmq Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -111,13 +111,14 @@ public void hostnameVerificationFailsBecauseCertificateNotIssuedForLoopbackInter
111111 fail ("The server certificate isn't issued for 127.0.0.1, the TLS handshake should have failed" );
112112 }
113113
114+ @ Test
114115 public void hostnameVerificationSucceeds () throws Exception {
115116 ConnectionFactory connectionFactory = TestUtils .connectionFactory ();
116117 connectionFactory .useSslProtocol (sslContext );
117118 customizer .accept (connectionFactory );
118- Connection conn = connectionFactory .newConnection (
119- () -> singletonList (new Address (Host .systemHostname (), ConnectionFactory .DEFAULT_AMQP_OVER_SSL_PORT )));
120- assertTrue (conn .isOpen ());
121- conn . close ();
119+ try ( Connection conn = connectionFactory .newConnection (
120+ () -> singletonList (new Address (Host .systemHostname (), ConnectionFactory .DEFAULT_AMQP_OVER_SSL_PORT )))) {
121+ assertTrue (conn .isOpen ());
122+ }
122123 }
123124}
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ public static Process invokeMakeTarget(String command) throws IOException {
122122
123123 public static String systemHostname () throws IOException {
124124 Process process = executeCommandIgnoringErrors ("hostname" );
125- return capture (process .getInputStream ());
125+ return capture (process .getInputStream ()). trim () ;
126126 }
127127
128128 public static String makeCommand ()
You can’t perform that action at this time.
0 commit comments