code: protected synchronized boolean write(byte[] bytes) {
          mConnectionLock.readLock().lock();
          boolean success = true;
          try {
              if(isConnected()) {
                  Log.v(TAG, "Writing " + bytes.length + " to socket");
                  mOutStream.write(bytes);
              } else {
                  Log.w(TAG, "No connection established, could not send anything.");
                  success = false;
              }
          } catch(IOException e) {
              Log.w(TAG, "Unable to write CAN message to Network. Error: " + e.toString());
              success = false;
          } finally {
              mConnectionLock.readLock().unlock();
          }
          return success;
      }
docs: Writes given data to the socket.
  
  @param bytes data to write to the socket.
  @return true if the data was written successfully.