TCPSocket.open in 1.8.6 Windows?

I have a program that works under Windows XP and Ruby 1.8.5. I just
switched to 1.8.6 and a new bug appeared.

In net/imap.rb, there is a statement "@sock = TCPSocket.open(host, port)".
If host is a remote URL (e.g., www.anywhere.com), it works. If host is
"localhost", or "127.0.0.1", or my local Host Name, or my local IP Address,
it fails with "Bad file descriptor - connect(2) (Errno::EBADF)".

Since most of my test sites are on my local computer, this makes testing
difficult, if not impossible.

Help?