#!/usr/bin/env ruby ## simple test to check for broken IO.select behavior as seen with jruby on aix using java6 or java7 ## require 'socket' begin port = ARGV.shift || '4321' server = TCPServer.new('localhost', port) client = TCPSocket.new('localhost', port) sock = server.accept r, w, e = IO.select([sock], [sock], [sock], 0) # At this point there shouldn't be anything on the socket for us to read fail 'IO.select may be broken on this system!' if (r && r.any?) puts 'It appears that IO.select may be functioning correctly on this system' ensure server.close if server client.close if client end