hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1698074 - /httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
Date Thu, 27 Aug 2015 04:55:23 GMT
Author: ggregory
Date: Thu Aug 27 04:55:23 2015
New Revision: 1698074

URL: http://svn.apache.org/r1698074
Log:
Use try-with-resources.

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java?rev=1698074&r1=1698073&r2=1698074&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/integration/TestServerSidePipelining.java
Thu Aug 27 04:55:23 2015
@@ -134,8 +134,7 @@ public class TestServerSidePipelining ex
         endpoint.waitFor();
 
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final Socket socket = new Socket("localhost", address.getPort());
-        try {
+        try (final Socket socket = new Socket("localhost", address.getPort())) {
             final OutputStream outstream = socket.getOutputStream();
             final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outstream,
"US-ASCII"));
             writer.write("GET / HTTP/1.1\r\n");
@@ -190,8 +189,6 @@ public class TestServerSidePipelining ex
                     "thank you very much";
             Assert.assertEquals(expected, buf.toString());
 
-        } finally {
-            socket.close();
         }
 
     }
@@ -204,8 +201,7 @@ public class TestServerSidePipelining ex
         endpoint.waitFor();
 
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final Socket socket = new Socket("localhost", address.getPort());
-        try {
+        try (final Socket socket = new Socket("localhost", address.getPort())) {
             final OutputStream outstream = socket.getOutputStream();
             final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outstream,
"US-ASCII"));
             writer.write("POST /echo HTTP/1.1\r\n");
@@ -269,8 +265,6 @@ public class TestServerSidePipelining ex
                     "and goodbye";
             Assert.assertEquals(expected, buf.toString());
 
-        } finally {
-            socket.close();
         }
 
     }
@@ -283,8 +277,7 @@ public class TestServerSidePipelining ex
         endpoint.waitFor();
 
         final InetSocketAddress address = (InetSocketAddress) endpoint.getAddress();
-        final Socket socket = new Socket("localhost", address.getPort());
-        try {
+        try (final Socket socket = new Socket("localhost", address.getPort())) {
             final OutputStream outstream = socket.getOutputStream();
             final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outstream,
"US-ASCII"));
             writer.write("POST /echo HTTP/1.1\r\n");
@@ -341,8 +334,6 @@ public class TestServerSidePipelining ex
                     "booo booo booo\r\n";
             Assert.assertEquals(expected, buf.toString());
 
-        } finally {
-            socket.close();
         }
     }
 



Mime
View raw message