package it.playfellas.superapp.network;

import it.playfellas.superapp.events.NetEvent;
import java.io.IOException;

public class SlavePeer {

  private BTSlaveThread btSlaveThread;
  private static SlavePeer slave;

  private SlavePeer() {
    super();
  }

  public synchronized static SlavePeer get() {
    if (slave == null) {
      slave = new SlavePeer();
    }
    return slave;
  }

  public void listenForConnection() throws IOException {
    btSlaveThread = new BTSlaveThread();
    btSlaveThread.start();
  }

  public void close() {
    btSlaveThread.deactivate();
  }

  public void sendMessage(NetEvent netEvent) throws IOException {
    btSlaveThread.write(netEvent);
  }
}

@@ -534,24 +534,58 @@
 d close() %7B%0A
+    if(btSlaveThread != null) %7B%0A  
     btSlaveT
@@ -600,24 +600,30 @@
 activate();%0A
+    %7D%0A
   %7D%0A%0A  publi

fix on close null slave thread