Code example for InetSocketAddress

0
        assertEquals(2L * str.length(), this.fileMessageSet.highWaterMark());
        final FileMessageSet subSet = (FileMessageSet) this.fileMessageSet.slice(0, 100);
 
        assertEquals(2L * str.length(), subSet.highWaterMark());
        final Connection conn = EasyMock.createMock(Connection.class);
        EasyMock.expect(conn.getRemoteSocketAddress()).andReturn(new InetSocketAddress(8181)).anyTimes();
 
        final int opaque = 99;
        final IoBuffer head = IoBuffer.wrap(("value " + 2 * str.length() + " " + opaque + "\r\n").getBytes());
        conn.transferFrom(head, null, this.fileMessageSet.channel(), 0, 2 * str.length());
        EasyMock.expectLastCall(); 
        EasyMock.replay(conn);
 
        subSet.write(new GetCommand("test", "boyan-test", -1, 0, 1024 * 1024, opaque), new SessionContextImpl(null,
            conn));
        EasyMock.verify(conn);
    } 
 
}