@Override
        public void run() {
            while (running) {
                try {
                    int count = in.read(buffer);
                    if (count > 0) {
                        byte[] bytes = new byte[count];
                        for (int i = 0; i < count && i < buffer.length; ++i) {
                            bytes[i] = (byte) buffer[i];
                        }
                        notifyListeners(bytes);
                    }
                }
                catch (IOException ex) {
                    Logger.getLogger(SocketChannel.class.getName()).log(Level.WARNING, Receiver.class.getName(), ex);
                    running = false;
                }
            }
        }