code: public static <T> T withStreams(Socket socket, @ClosureParams(value=SimpleType.class, options={"java.io.InputStream","java.io.OutputStream"}) Closure<T> closure) throws IOException {
          InputStream input = socket.getInputStream();
          OutputStream output = socket.getOutputStream();
          try {
              T result = closure.call(new Object[]{input, output});
  
              InputStream temp1 = input;
              input = null;
              temp1.close();
              OutputStream temp2 = output;
              output = null;
              temp2.close();
  
              return result;
          } finally {
              closeWithWarning(input);
              closeWithWarning(output);
          }
      }
docs: Passes the Socket's InputStream and OutputStream to the closure.  The
  streams will be closed after the closure returns, even if an exception
  is thrown.
  
  @param socket  a Socket
  @param closure a Closure
  @return the value returned by the closure
  @throws IOException if an IOException occurs.
  @since 1.5.2