Fixed a connection issue in JRuby

For some reason JRuby raises EINPROGRESS in this particular case.
Fixed another JRuby connection issue

Must do another connect_nonblock before writing to the socket when it first becomes writable.
Added perftools.rb for MRI