moved socket creation to synchronized method

@gsoltis this should fix the race condition that occurred when closing the socket while connecting
I think if the actual thing we're trying to protect is the internal call,
we should at least synchronize that one. That keeps someone else from
adding a new send method and not properly synchronizing it. Keeping them on
the public-facing methods as well is probably ok if you want to provide an
indicator to users about the potential for blocking.

On Thu, Sep 11, 2014 at 2:15 PM, jdimond <notifications@github.com> wrote:

> In src/main/java/com/firebase/tubesock/WebSocket.java:
>
> > @@ -172,7 +177,7 @@ public void run() {
> >       * Send a TEXT message over the socket
> >       * @param data The text payload to be sent
> >       */
> > -    public void send(String data) {
> > +    public synchronized void send(String data) {
>
> I like to keep public methods synchronized and private methods
> unsynchronized in general. Personal taste. Should I change it?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/firebase/TubeSock/pull/2/files#r17449613>.
>