@Implementation
  protected BluetoothSocket accept(int timeout) throws IOException {
    if (closed) {
      throw new IOException("Socket closed");
    }

    BluetoothSocket socket;
    try {
      socket = timeout == -1
              ? sockets.take() : sockets.poll(timeout, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      throw new IOException(e);
    }

    if (socket == null) {
      throw new IOException("Timeout occurred");
    }
    socket.connect();
    return socket;
  }
@Implementation
  protected BluetoothSocket accept(int timeout) throws IOException {
    if (closed) {
      throw new IOException("Socket closed");
    }

    BluetoothSocket socket;
    try {
      socket = timeout == -1
              ? sockets.take() : sockets.poll(timeout, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      throw new IOException(e);
    }

    if (socket == null) {
      throw new IOException("Timeout occurred");
    }
    socket.connect();
    return socket;
  }
@ Implementation protected BluetoothSocket accept ( int timeout ) throws IOException { if ( closed ) { throw new IOException ( "Socket closed" ) ; } BluetoothSocket socket ; try { socket = timeout == - 1 ? sockets . take ( ) : sockets . poll ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException e ) { throw new IOException ( e ) ; } if ( socket == null ) { throw new IOException ( "Timeout occurred" ) ; } socket . connect ( ) ; return socket ; }
May block the current thread and wait until {@link BluetoothDevice} is offered via
{@link #deviceConnected(BluetoothDevice)} method or timeout occurred.

@return socket of the connected bluetooth device
@throws IOException if socket has been closed, thread interrupted while waiting or timeout has
occurred.
May block the current thread and wait until { @link BluetoothDevice } is offered via { @link #deviceConnected ( BluetoothDevice ) } method or timeout occurred .