# \[Bug #465\] \`Errno::ENOTCONN: Socket is not connected' in test/net/imap

**URL:** <https://www.ruby-forum.com/t/bug-465-errno-socket-is-not-connected-in-test-net-imap/146464>\
**Category:** Development\
**Created:** [August 21, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/bug-465-errno-socket-is-not-connected-in-test-net-imap/146464 "2008-08-21T12:15:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/77aa72/32.png) [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Post date:** [August 21, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/bug-465-errno-socket-is-not-connected-in-test-net-imap/146464/1 "2008-08-21T12:15:53Z")

</div>

Bug #465: `Errno::ENOTCONN: Socket is not connected’ in test/net/imap  
[http://redmine.ruby-lang.org/issues/show/465](http://redmine.ruby-lang.org/issues/show/465)

e$B5/I\<\<Te(B: Kazuhiro NISHIYAMA  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal  
e$BC4Ev\<Te(B: GOTOU Yuuzou

test/net/imape$B$G$bF1MM$Ke(BErrno::ENOTCONNe$B$K$J$j$^$9!#e(B

1. Error:  
test\_unexpected\_eof(IMAPTest):  
Errno::ENOTCONN: Socket is not connected  
/Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/lib/net/imap.rb:295:in  
`shutdown' /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/lib/net/imap.rb:295:in `rescue in disconnect’  
/Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/lib/net/imap.rb:290:in  
`disconnect' /Users/chkbuild/chkbuild/tmp/build/ruby-trunk/20080821T033314/ruby/test/net/imap/test_imap.rb:108:in `test\_unexpected\_eof’

e$B0J2\<%Q%C%A$G$9!#e(B

# Index: lib/net/imap.rb

— lib/net/imap.rb (revision 18748)  
+++ lib/net/imap.rb (working copy)  
@@ -288,11 +288,15 @@  
# Disconnects from the server.  
def disconnect  
begin

- 

```
   # try to call SSL::SSLSocket#io.

```

- 

```
   @sock.io.shutdown

```

- 

```
 rescue NoMethodError

```

- 

```
   # @sock is not an SSL::SSLSocket.

```

- 

```
   @sock.shutdown

```

- 

```
   begin

```

- 

```
     # try to call SSL::SSLSocket#io.

```

- 

```
     @sock.io.shutdown

```

- 

```
   rescue NoMethodError

```

- 

```
     # @sock is not an SSL::SSLSocket.

```

- 

```
     @sock.shutdown

```

- 

```
   end

```

- 

```
 rescue Errno::ENOTCONN

```

- 

```
   # ignore `Errno::ENOTCONN: Socket is not connected' on some 

```

platforms.  
end  
@receiver\_thread.join  
@sock.close

---

<div class="post-metadata">

**Author:** ![Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/77aa72/32.png) [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Post date:** [August 23, 2008, 11:57am UTC](https://www.ruby-forum.com/t/bug-465-errno-socket-is-not-connected-in-test-net-imap/146464/2 "2008-08-23T11:57:27Z")

</div>

e$B%A%1%C%He(B #465 e$B$,99?7$5$l$^$7$?!#e(B (by Kazuhiro NISHIYAMA)

e$B%9%F!\<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

## r18777

[http://redmine.ruby-lang.org/issues/show/465](http://redmine.ruby-lang.org/issues/show/465)
