Code example for Socket

Methods: close

0
   * {@code socket} is null. 
   */ 
  public static void closeQuietly(Socket socket) {
    if (socket != null) {
      try { 
        socket.close();
      } catch (RuntimeException rethrown) {
        throw rethrown;
      } catch (Exception ignored) {
      } 
    } 
  } 
 
  /** 
   * Closes {@code a} and {@code b}. If either close fails, this completes 
   * the other close and rethrows the first encountered exception. 
   */ 
  public static void closeAll(Closeable a, Closeable b) throws IOException {
    Throwable thrown = null;
    try { 
      a.close();