summaryrefslogtreecommitdiff
path: root/test/net/imap
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 05:12:39 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-16 05:12:39 +0000
commit6853b44a9260390b6e688e7c42aedcd5540e291f (patch)
tree04670c0b8a94b612832ba3e1b9b8431f6d96bbdd /test/net/imap
parented07df5ab5e183aed62cbe33f50a57640617d7a4 (diff)
* lib/net/imap.rb (initialize): raise Net::IMAP::Error when the
connection is closed without a greeting response. [ruby-core:40938] [Bug #5616] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/imap')
-rw-r--r--test/net/imap/test_imap.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index cf179c85d83..df9cd8b8a22 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -418,6 +418,25 @@ class IMAPTest < Test::Unit::TestCase
end
end
+ def test_connection_closed_without_greeting
+ server = create_tcp_server
+ port = server.addr[1]
+ Thread.start do
+ begin
+ sock = server.accept
+ sock.close
+ rescue
+ end
+ end
+ begin
+ assert_raise(Net::IMAP::Error) do
+ Net::IMAP.new(SERVER_ADDR, :port => port)
+ end
+ ensure
+ server.close
+ end
+ end
+
def test_default_port
assert_equal(143, Net::IMAP.default_port)
assert_equal(143, Net::IMAP.default_imap_port)