package co.codesharp.jwampsharp.defaultBinding;

import co.codesharp.jwampsharp.api.client.WampChannel;
import co.codesharp.jwampsharp.api.client.WampChannelFactoryImpl;
import co.codesharp.jwampsharp.core.binding.WampTextBinding;
import co.codesharp.jwampsharp.defaultBinding.jsr.WebsocketWampTextConnection;

import java.net.URI;

/**
 * Created by Elad on 7/11/2014.
 */
public class DefaultWampChannelFactory extends WampChannelFactoryImpl {
    public <TMessage> WampChannel createChannel
            (URI address,
             String realm,
             WampTextBinding<TMessage> binding) {
        WebsocketWampTextConnection<TMessage> connection =
                new WebsocketWampTextConnection<TMessage>(address, binding);

        return this.createChannel(realm, connection, binding);
    }

    public WampChannel createJsonChannel(URI address,
                                          String realm) {
        JsonNodeBinding binding = new JsonNodeBinding();

        return this.createChannel(address, realm, binding);
    }
}
@@ -439,16 +439,87 @@
 yImpl %7B%0A
+%0A    private JsonNodeBinding jsonNodeBinding = new JsonNodeBinding();%0A%0A
     publ
@@ -984,66 +984,8 @@
 ) %7B%0A
-        JsonNodeBinding binding = new JsonNodeBinding();%0A%0A
     
@@ -1030,17 +1030,25 @@
  realm, 
-b
+jsonNodeB
 inding);

Use the same reference for all method calls