BluetoothSocketIoThread extends Thread { public void setExitThreadAfterRead(boolean exit) { mExitThreadAfterRead = exit; } BluetoothSocketIoThread(BluetoothSocket socket, Listener listener); BluetoothSocket getSocket(); @Nullable PeerProperties getPeerProperties(); void setPeerProperties(PeerProperties peerProperties); void setExitThreadAfterRead(boolean exit); int getBufferSize(); void setBufferSize(int bufferSizeInBytes); @Override void run(); boolean write(byte[] bytes); synchronized void close(boolean closeStreams, boolean closeSocket);  }
@Test public void testSetExitThreadAfterRead() throws Exception { mBluetoothSocketIoThread.setBufferSize(0); assertThat("The buffer size can't be set to 0 and lower", mBluetoothSocketIoThread.getBufferSize(), is(BluetoothSocketIoThread.DEFAULT_BUFFER_SIZE_IN_BYTES)); mBluetoothSocketIoThread.setBufferSize(100); assertThat("The buffer size is properly set", mBluetoothSocketIoThread.getBufferSize(), is(100)); }