Hmmm, what do you mean with "ok"?
Speed, stability or the simple fact that a connection is open?
I doubt that there is a simple solution for the first two options, but the third can be tested easily, I guess.
How about requesting the HEADER from a site you know, that should be available? Like Google.
If you get a response, it would tell you that you are online. You could even parse the Date and Time to be really sure.
But do not ask how to ..... ;