public void disconnect(){
  if (protocol == PROTOCOL_HTTP)   return;
  try {
    if (socket != null) {
      if (!socket.isClosed()) {
        socket.close();
      }
    }
  }
 catch (  IOException e) {
    LogUtils.LOGE(TAG,"Error while closing socket",e);
  }
 finally {
    socket=null;
  }
}

public void disconnect ( ) { if ( protocol == PROTOCOL_HTTP ) return ; try { if ( socket != null ) { if ( ! socket . isClosed ( ) ) { socket . close ( ) ; } } } catch ( IOException e ) { LogUtils . LOGE ( TAG , "Error while closing socket" , e ) ; } finally { socket = null ; } }
cleans up used resources . this method should always be called if the protocol used is tcp , so we can shutdown gracefully
