summaryrefslogtreecommitdiff
path: root/test/net/imap
diff options
context:
space:
mode:
Diffstat (limited to 'test/net/imap')
-rw-r--r--test/net/imap/test_imap.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index 35e5ed8982..3224da65a1 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -526,6 +526,33 @@ class IMAPTest < Test::Unit::TestCase
end
end
+ def test_disconnect
+ server = create_tcp_server
+ port = server.addr[1]
+ @threads << Thread.start do
+ sock = server.accept
+ begin
+ sock.print("* OK test server\r\n")
+ sock.gets
+ sock.print("* BYE terminating connection\r\n")
+ sock.print("RUBY0001 OK LOGOUT completed\r\n")
+ ensure
+ sock.close
+ server.close
+ end
+ end
+ begin
+ imap = Net::IMAP.new(SERVER_ADDR, :port => port)
+ imap.logout
+ imap.disconnect
+ assert_equal(true, imap.disconnected?)
+ imap.disconnect
+ assert_equal(true, imap.disconnected?)
+ ensure
+ imap.disconnect if imap && !imap.disconnected?
+ end
+ end
+
private
def imaps_test