File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
examples/demo/src/main/java/com/datagramSocket Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,27 @@ public void testOk() throws Exception {
2121 ds .close ();
2222 }
2323
24- public void testSendingAfterDisconnecting () throws Exception {
24+ public void testBindTwice () throws Exception {
2525 DatagramSocket ds = new DatagramSocket (8080 );
26- ds .connect (null );
27- ds .disconnect ();
28- ds .send (null ); // error
26+ ds .bind (null ); // error
2927 }
3028
3129 public void testBindingAfterAlreadyBound () throws Exception {
3230 DatagramSocket ds = new DatagramSocket (8080 );
3331 ds .bind (null ); // error
3432 }
33+
34+ public void testConnectingAfterClosing () throws Exception {
35+ DatagramSocket ds = new DatagramSocket (8080 );
36+ ds .connect (null );
37+ ds .close ();
38+ ds .connect (null ); // error
39+ }
40+
41+ public void testBound () throws Exception {
42+ DatagramSocket ds = new DatagramSocket (8080 );
43+ if (!ds .isBound ()) {
44+ ds .bind (null ); // this should not be an error
45+ }
46+ }
3547}
You can’t perform that action at this time.
0 commit comments