SocketStreamHandle::SocketStreamHandle(GSocketConnection* socketConnection, SocketStreamHandleClient* client)
    : SocketStreamHandleBase(URL(), client)
{
    LOG(Network, "SocketStreamHandle %p new client %p", this, m_client);
    m_id = activateHandle(this);
    connected(socketConnection, 0);
}
SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client)
    : SocketStreamHandleBase(url, client)
    , m_readBuffer(0)
{
    unsigned int port = url.hasPort() ? url.port() : (url.protocolIs("wss") ? 443 : 80);

    m_id = activateHandle(this);
    GRefPtr<GSocketClient> socketClient = adoptGRef(g_socket_client_new());
    if (url.protocolIs("wss"))
        g_socket_client_set_tls(socketClient.get(), TRUE);
    g_socket_client_connect_to_host_async(socketClient.get(), url.host().utf8().data(), port, 0,
        reinterpret_cast<GAsyncReadyCallback>(connectedCallback), m_id);
}