public void run()
        {
            try
            {
                SocketChannel socketChannel = SocketChannel.open();
                socketChannel.socket().setReceiveBufferSize( m_socketBufferSize );

                StreamDefragger streamDefragger = new StreamDefragger(4)
                {
                    protected int validateHeader( ByteBuffer header )
                    {
                        return header.getInt();
                    }
                };

                if (!socketChannel.connect(m_addr) || !socketChannel.finishConnect())
                {
                    System.out.println( "SocketChannel.connect() failed." );
                    return;
                }

                ByteBuffer bb = ByteBuffer.allocateDirect( m_socketBufferSize );

                ByteBuffer startRequest = m_startRequest.duplicate();
                final int bytesSent = socketChannel.write( startRequest );
                if (bytesSent != startRequest.capacity())
                {
                    System.out.println( "SocketChannel.send() failed." );
                    return;
                }

                int messages = 0;
                int bytesReceivedTotal = 0;
                long startTime = 0;

                readSocketLoop: for (;;)
                {
                    final int bytesReceived = socketChannel.read( bb );
                    if (bytesReceived > 0)
                    {
                        if (bytesReceivedTotal == 0)
                            startTime = System.nanoTime();
                        bytesReceivedTotal += bytesReceived;

                        bb.position( 0 );
                        bb.limit( bytesReceived );
                        ByteBuffer msg = streamDefragger.getNext( bb );
                        while (msg != null)
                        {
                            final int messageLength = msg.getInt();
                            assert( messageLength == m_messageLength );
                            if (++messages == m_messages)
                                break readSocketLoop;
                            msg = streamDefragger.getNext();
                        }
                        bb.clear();
                    }
                }
                long entTime = System.nanoTime();
                socketChannel.close();

                System.out.println(
                        "Received " + messages + " messages (" + bytesReceivedTotal +
                        " bytes) at " + Util.formatDelay(startTime, entTime) + "." );
            }
            catch (IOException ex)
            {
                ex.printStackTrace();
            }
        }