public void read(final ProtocolDecoder decoder) throws Exception
    {
		// Read until protocol has enough data to decode
		buffer.clear();
		do
		{
			channel.read(buffer).get(timeout_ms, MILLISECONDS);
		}
		while (buffer.position() < decoder.getResponseSize(buffer));
		
		// Prepare to decode
		buffer.flip();

		if (logger.isLoggable(Level.FINEST))
			logger.log(Level.FINEST, "Data read ({0} bytes):\n{1}",
					new Object[] { buffer.remaining(), Hexdump.toHexdump(buffer) });

		final StringBuilder log = logger.isLoggable(Level.FINER) ? new StringBuilder() : null;
		try
		{
		    decoder.decode(buffer, buffer.remaining(), log);
		}
		finally
		{   // Show log even on error
    		if (log != null)
    			logger.finer("Protocol Decoding\n" + log.toString());
		}
    }