hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1789730 - /httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
Date Fri, 31 Mar 2017 18:50:32 GMT
Author: ggregory
Date: Fri Mar 31 18:50:32 2017
New Revision: 1789730

URL: http://svn.apache.org/viewvc?rev=1789730&view=rev
Log:
Fix compiler warning: Use try-with-resources.

Modified:
    httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java

Modified: httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java?rev=1789730&r1=1789729&r2=1789730&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5/src/test/java/org/apache/hc/core5/ssl/TestSSLContextBuilder.java
Fri Mar 31 18:50:32 2017
@@ -163,15 +163,12 @@ public class TestSSLContextBuilder {
         });
 
         final int localPort = serverSocket.getLocalPort();
-        final Socket clientSocket = clientSslContext.getSocketFactory().createSocket();
-        try {
+        try (final Socket clientSocket = clientSslContext.getSocketFactory().createSocket())
{
             clientSocket.connect(new InetSocketAddress("localhost", localPort), 5000);
             final InputStream inputStream = clientSocket.getInputStream();
             Assert.assertEquals('H', inputStream.read());
             Assert.assertEquals('i', inputStream.read());
             Assert.assertEquals(-1, inputStream.read());
-        } finally {
-            clientSocket.close();
         }
 
         final Boolean result = future.get(5, TimeUnit.SECONDS);



Mime
View raw message