test/jdk/java/net/SocketImpl/CustomSocketImpls.java
branchniosocketimpl-branch
changeset 57200 4446b7c9bc1f
parent 57199 88a41734ddbe
equal deleted inserted replaced
57199:88a41734ddbe 57200:4446b7c9bc1f
   246             } finally {
   246             } finally {
   247                 setSocketImplFactory(null);
   247                 setSocketImplFactory(null);
   248             }
   248             }
   249         } finally {
   249         } finally {
   250             if (s1 != null) s1.close();
   250             if (s1 != null) s1.close();
   251             if (s2 != null) s1.close();
   251             if (s2 != null) s2.close();
   252         }
   252         }
   253     }
   253     }
   254 
   254 
   255     /**
   255     /**
   256      * ServerSocket using a custom SocketImpl. A SocketImplFactory is set to
   256      * ServerSocket using a custom SocketImpl. A SocketImplFactory is set to
   273             } finally {
   273             } finally {
   274                 setSocketImplFactory(null);
   274                 setSocketImplFactory(null);
   275             }
   275             }
   276         } finally {
   276         } finally {
   277             if (s1 != null) s1.close();
   277             if (s1 != null) s1.close();
   278             if (s2 != null) s1.close();
   278             if (s2 != null) s2.close();
   279         }
   279         }
   280     }
   280     }
   281 
   281 
   282     /**
   282     /**
   283      * Creates a ServerSocket that returns the given Socket from accept.
   283      * Creates a ServerSocket that returns the given Socket from accept.
   292             s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
   292             s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
   293             s2 = ss.accept();
   293             s2 = ss.accept();
   294             consumer.accept(s2);
   294             consumer.accept(s2);
   295         } finally {
   295         } finally {
   296             if (s1 != null) s1.close();
   296             if (s1 != null) s1.close();
   297             if (s2 != null) s1.close();
   297             if (s2 != null) s2.close();
   298         }
   298         }
   299     }
   299     }
   300 
   300 
   301     /**
   301     /**
   302      * Creates a ServerSocket that returns the given Socket from accept. The
   302      * Creates a ServerSocket that returns the given Socket from accept. The
   317                 setSocketImplFactory(null);
   317                 setSocketImplFactory(null);
   318             }
   318             }
   319             consumer.accept(s2);
   319             consumer.accept(s2);
   320         } finally {
   320         } finally {
   321             if (s1 != null) s1.close();
   321             if (s1 != null) s1.close();
   322             if (s2 != null) s1.close();
   322             if (s2 != null) s2.close();
   323         }
   323         }
   324     }
   324     }
   325 
   325 
   326     /**
   326     /**
   327      * Creates a ServerSocket with a SocketImpl that returns the given Socket
   327      * Creates a ServerSocket with a SocketImpl that returns the given Socket
   336             s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
   336             s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
   337             s2 = ss.accept();
   337             s2 = ss.accept();
   338             consumer.accept(s2);
   338             consumer.accept(s2);
   339         } finally {
   339         } finally {
   340             if (s1 != null) s1.close();
   340             if (s1 != null) s1.close();
   341             if (s2 != null) s1.close();
   341             if (s2 != null) s2.close();
   342         }
   342         }
   343     }
   343     }
   344 
   344 
   345     /**
   345     /**
   346      * Creates a ServerSocket that returns the given Socket from accept.
   346      * Creates a ServerSocket that returns the given Socket from accept.