Message { public Message setDataMap(final DataMap dataMap) { if (!presetContentTypes) { contentType(Content.MAP_KEY640_DATA); } if (dataMapList == null) { dataMapList = new ArrayList<DataMap>(1); } this.dataMapList.add(dataMap); return this; } Message(); int messageId(); Message messageId(final int messageId); int version(); Message version(final int version); Type type(); Message type(final Type type); byte command(); Message command(final byte command); PeerAddress sender(); Message sender(final PeerAddress sender); PeerAddress recipient(); Message recipient(final PeerAddress recipient); PeerAddress recipientRelay(); Message recipientRelay(PeerAddress recipientRelay); Content[] contentTypes(); Message contentType(final Content contentType); void restoreContentReferences(); void restoreBuffers(); Message contentType(final int index, final Content contentType); Message contentTypes(final Content[] contentTypes); Queue<MessageContentIndex> contentReferences(); boolean hasContent(); Message hasContent(final boolean content); boolean isRequest(); boolean isFireAndForget(); boolean isOk(); boolean isNotOk(); boolean isError(); static boolean isError(final Type type); Message options(final int options); int options(); Message keepAlive(final boolean isKeepAlive); boolean isKeepAlive(); Message streaming(); Message streaming(boolean streaming); boolean isStreaming(); Message expectDuplicate(boolean expectDuplicate); boolean isExpectDuplicate(); Message key(final Number160 key); List<Number160> keyList(); Number160 key(final int index); Message bloomFilter(final SimpleBloomFilter<Number160> bloomFilter); List<SimpleBloomFilter<Number160>> bloomFilterList(); SimpleBloomFilter<Number160> bloomFilter(final int index); Message publicKeyAndSign(KeyPair keyPair); Message intValue(final int integer); List<Integer> intList(); Integer intAt(final int index); Message longValue(long long0); List<Long> longList(); Long longAt(int index); Message neighborsSet(final NeighborSet neighborSet); List<NeighborSet> neighborsSetList(); NeighborSet neighborsSet(final int index); Message setDataMap(final DataMap dataMap); List<DataMap> dataMapList(); DataMap dataMap(final int index); Message keyCollection(final KeyCollection key); List<KeyCollection> keyCollectionList(); KeyCollection keyCollection(final int index); Message keyMap640Keys(final KeyMap640Keys keyMap); List<KeyMap640Keys> keyMap640KeysList(); KeyMap640Keys keyMap640Keys(final int index); Message keyMapByte(final KeyMapByte keyMap); List<KeyMapByte> keyMapByteList(); KeyMapByte keyMapByte(final int index); Message publicKey(final PublicKey publicKey); List<PublicKey> publicKeyList(); PublicKey publicKey(final int index); Message peerSocketAddresses(Collection<PeerSocketAddress> peerSocketAddresses); List<PeerSocketAddress> peerSocketAddresses(); PrivateKey privateKey(); Message buffer(final Buffer byteBuf); List<Buffer> bufferList(); Buffer buffer(final int index); Message trackerData(final TrackerData trackerData); List<TrackerData> trackerDataList(); TrackerData trackerData(final int index); Message receivedSignature(SignatureCodec signatureEncode); SignatureCodec receivedSignature(); @Override String toString(); Message presetContentTypes(final boolean presetContentTypes); Message senderSocket(final InetSocketAddress senderSocket); InetSocketAddress senderSocket(); Message recipientSocket(InetSocketAddress recipientSocket); InetSocketAddress recipientSocket(); Message setHintSign(); boolean isSign(); Message udp(final boolean udp); boolean isUdp(); Message verified(boolean verified); boolean verified(); Message setVerified(); Message setDone(final boolean done); Message setDone(); boolean isDone(); Message sendSelf(final boolean sendSelf); Message sendSelf(); boolean isSendSelf(); Message duplicate(); Message duplicate(DataFilter dataFilter); int estimateSize(); static final int CONTENT_TYPE_LENGTH; }
@Test public void testBigData() throws Exception { final int size = 50 * 1024 * 1024; Random rnd = new Random(42); Message m1 = Utils2.createDummyMessage(); NavigableMap<Number640, Data> dataMap = new TreeMap<Number640, Data>(); Data data = new Data(new byte[size]); dataMap.put(new Number640(rnd), data); m1.setDataMap(new DataMap(dataMap)); Message m2 = encodeDecode(m1); compareMessage(m1, m2); }