message: fix off-by-one bug

will add example that tests the integration.

Change-Id: Iaeeb2a460db994ba07e1fa283daba14587d27171
Reviewed-on: https://go-review.googlesource.com/58913
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
3 files changed