refactor rtsp and spdy into separate subprojects

This commit is contained in:
Jörg Prante 2024-01-06 17:48:55 +01:00
parent e38bced645
commit f9b231c1be
81 changed files with 176 additions and 121 deletions

View file

@ -24,7 +24,22 @@ The following changes were performed on the original source code:
Challenges for Netty build on JDK 21
- unmaintained com.jcraft.jzlib
- JCTools uses sun.misc.Unsafe, not VarHandles
- PlatformDependent uses sun.misc.Unsafe
- finalize() in PoolThreadCache, PoolArena
- unmaintained com.jcraft.jzlib, subproject netty-zlib maintains a copy of com.jcraft.zlib
- JCTools uses sun.misc.Unsafe, not VarHandles, subproject netty-jctools maintains a copy of jctools
- PlatformDependent uses sun.misc.Unsafe. Tests run successful by -add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED and
--add-opens=jdk.unsupported/sun.misc=ALL-UNNAMED
- finalize() calls in PoolThreadCache, PoolArena are deprecated
- when using boringssl static, setting of SSLContent.useTasks to false makes tests hang. Tests using false setting were removed.
Subproject organization
Original netty subproject names are not related to package names. I reorganized the names to allow better assignment
between subproject name, package name, artifact names, and java module. The following reorgnizations were performed:
all -> [todo]
bom -> [todo]
buffer -> netty-buffer
codec -> netty-handler-codec, netty-handler-codec-compression, netty-handler-codec-protobuf
codec-dns -> [todo]
codec-haproxy -> [todo]
codec-http -> netty-handler-codec-http, netty-handler-codec-rtsp, netty-handler-codec-spdy

View file

@ -1,3 +1,3 @@
group = org.xbib
group = org.xbib.netty
name = netty
version = 4.1.104

View file

@ -31,7 +31,7 @@ public class Bzip2BitReader {
/**
* The {@link ByteBuf} from which to read data.
*/
private ByteBuf in;
private ByteBuf byteBuf;
/**
* A buffer of bits read from the input stream that have not yet been returned.
@ -46,8 +46,8 @@ public class Bzip2BitReader {
/**
* Set the {@link ByteBuf} from which to read data.
*/
public void setByteBuf(ByteBuf in) {
this.in = in;
public void setByteBuf(ByteBuf byteBuf) {
this.byteBuf = byteBuf;
}
/**
@ -65,24 +65,24 @@ public class Bzip2BitReader {
if (bitCount < count) {
long readData;
int offset;
switch (in.readableBytes()) {
switch (byteBuf.readableBytes()) {
case 1: {
readData = in.readUnsignedByte();
readData = byteBuf.readUnsignedByte();
offset = 8;
break;
}
case 2: {
readData = in.readUnsignedShort();
readData = byteBuf.readUnsignedShort();
offset = 16;
break;
}
case 3: {
readData = in.readUnsignedMedium();
readData = byteBuf.readUnsignedMedium();
offset = 24;
break;
}
default: {
readData = in.readUnsignedInt();
readData = byteBuf.readUnsignedInt();
offset = 32;
break;
}
@ -117,7 +117,7 @@ public class Bzip2BitReader {
* Refill the {@link ByteBuf} by one byte.
*/
public void refill() {
int readData = in.readUnsignedByte();
int readData = byteBuf.readUnsignedByte();
bitBuffer = bitBuffer << 8 | readData;
bitCount += 8;
}
@ -127,7 +127,7 @@ public class Bzip2BitReader {
* @return {@code true} if one bit is available for reading, otherwise {@code false}
*/
public boolean isReadable() {
return bitCount > 0 || in.isReadable();
return bitCount > 0 || byteBuf.isReadable();
}
/**
@ -139,7 +139,7 @@ public class Bzip2BitReader {
if (count < 0) {
throw new IllegalArgumentException("count: " + count + " (expected value greater than 0)");
}
return bitCount >= count || (in.readableBytes() << 3 & Integer.MAX_VALUE) >= count - bitCount;
return bitCount >= count || (byteBuf.readableBytes() << 3 & Integer.MAX_VALUE) >= count - bitCount;
}
/**

View file

@ -3,7 +3,6 @@ dependencies {
implementation project(':netty-bzip2')
implementation project(':netty-zlib')
implementation libs.brotli4j
implementation libs.jzlib
implementation libs.lz4
implementation libs.lzf
implementation libs.zstd

View file

@ -0,0 +1,3 @@
dependencies {
api project(':netty-handler-codec-http')
}

View file

@ -84,8 +84,8 @@ public class RtspDecoder extends HttpObjectDecoder {
* {@code maxContentLength (8192)}.
*/
public RtspDecoder() {
this(DEFAULT_MAX_INITIAL_LINE_LENGTH,
DEFAULT_MAX_HEADER_SIZE,
this(HttpObjectDecoder.DEFAULT_MAX_INITIAL_LINE_LENGTH,
HttpObjectDecoder.DEFAULT_MAX_HEADER_SIZE,
DEFAULT_MAX_CONTENT_LENGTH);
}

View file

@ -18,6 +18,7 @@ package io.netty.handler.codec.rtsp;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.handler.codec.UnsupportedMessageTypeException;
import io.netty.handler.codec.http.HttpConstants;
import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.HttpMessage;
import io.netty.handler.codec.http.HttpObjectEncoder;
@ -26,14 +27,12 @@ import io.netty.handler.codec.http.HttpResponse;
import io.netty.util.CharsetUtil;
import io.netty.util.internal.StringUtil;
import static io.netty.handler.codec.http.HttpConstants.*;
/**
* Encodes an RTSP message represented in {@link HttpMessage} or an {@link HttpContent} into
* a {@link ByteBuf}.
*/
public class RtspEncoder extends HttpObjectEncoder<HttpMessage> {
private static final int CRLF_SHORT = (CR << 8) | LF;
private static final int CRLF_SHORT = (HttpConstants.CR << 8) | HttpConstants.LF;
@Override
public boolean acceptOutboundMessage(final Object msg)
@ -47,17 +46,17 @@ public class RtspEncoder extends HttpObjectEncoder<HttpMessage> {
if (message instanceof HttpRequest) {
HttpRequest request = (HttpRequest) message;
ByteBufUtil.copy(request.method().asciiName(), buf);
buf.writeByte(SP);
buf.writeByte(HttpConstants.SP);
buf.writeCharSequence(request.uri(), CharsetUtil.UTF_8);
buf.writeByte(SP);
buf.writeByte(HttpConstants.SP);
buf.writeCharSequence(request.protocolVersion().toString(), CharsetUtil.US_ASCII);
ByteBufUtil.writeShortBE(buf, CRLF_SHORT);
} else if (message instanceof HttpResponse) {
HttpResponse response = (HttpResponse) message;
buf.writeCharSequence(response.protocolVersion().toString(), CharsetUtil.US_ASCII);
buf.writeByte(SP);
buf.writeByte(HttpConstants.SP);
ByteBufUtil.copy(response.status().codeAsText(), buf);
buf.writeByte(SP);
buf.writeByte(HttpConstants.SP);
buf.writeCharSequence(response.status().reasonPhrase(), CharsetUtil.US_ASCII);
ByteBufUtil.writeShortBE(buf, CRLF_SHORT);
} else {

View file

@ -15,10 +15,9 @@
*/
package io.netty.handler.codec.rtsp;
import static io.netty.util.internal.ObjectUtil.checkNonEmptyAfterTrim;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.util.internal.ObjectUtil;
import java.util.HashMap;
import java.util.Map;
@ -119,7 +118,7 @@ public final class RtspMethods {
* will be returned. Otherwise, a new instance will be returned.
*/
public static HttpMethod valueOf(String name) {
name = checkNonEmptyAfterTrim(name, "name").toUpperCase();
name = ObjectUtil.checkNonEmptyAfterTrim(name, "name").toUpperCase();
HttpMethod result = methodMap.get(name);
if (result != null) {
return result;

View file

@ -61,7 +61,7 @@ public abstract class RtspObjectDecoder extends HttpObjectDecoder {
* {@code maxContentLength (8192)}.
*/
protected RtspObjectDecoder() {
this(DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_MAX_HEADER_SIZE, DEFAULT_MAX_CONTENT_LENGTH);
this(HttpObjectDecoder.DEFAULT_MAX_INITIAL_LINE_LENGTH, HttpObjectDecoder.DEFAULT_MAX_HEADER_SIZE, DEFAULT_MAX_CONTENT_LENGTH);
}
/**

View file

@ -0,0 +1,8 @@
module org.xbib.io.netty.handler.codec.rtsp {
exports io.netty.handler.codec.rtsp;
requires org.xbib.io.netty.buffer;
requires org.xbib.io.netty.channel;
requires org.xbib.io.netty.handler.codec;
requires org.xbib.io.netty.handler.codec.http;
requires org.xbib.io.netty.util;
}

View file

@ -0,0 +1,7 @@
handlers=java.util.logging.ConsoleHandler
.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s [%3$s] %5$s %6$s%n
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
jdk.event.security.level=INFO
org.junit.jupiter.engine.execution.ConditionEvaluator.level=OFF

View file

@ -0,0 +1,6 @@
dependencies {
api project(':netty-handler-codec-http')
implementation project(':netty-zlib')
testImplementation testLibs.assertj
testImplementation testLibs.mockito.core
}

View file

@ -0,0 +1,10 @@
module org.xbib.io.netty.handler.codec.spdy {
exports io.netty.handler.codec.spdy;
requires org.xbib.io.netty.buffer;
requires org.xbib.io.netty.channel;
requires org.xbib.io.netty.handler.codec;
requires org.xbib.io.netty.handler.codec.compression;
requires org.xbib.io.netty.handler.codec.http;
requires org.xbib.io.netty.util;
requires org.xbib.io.netty.zlib;
}

View file

@ -25,21 +25,18 @@ import org.junit.jupiter.api.Test;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Random;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import static io.netty.handler.codec.spdy.SpdyCodecUtil.SPDY_HEADER_SIZE;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
public class SpdyFrameDecoderTest {
private static final Random RANDOM = new Random();
private final SpdyFrameDecoderDelegate delegate = mock(SpdyFrameDecoderDelegate.class);
private final SpdyFrameDecoderDelegate delegate = Mockito.mock(SpdyFrameDecoderDelegate.class);
private final TestSpdyFrameDecoderDelegate testDelegate = new TestSpdyFrameDecoderDelegate();
private SpdyFrameDecoder decoder;
@ -165,7 +162,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(RANDOM.nextInt());
}
decoder.decode(buf);
verify(delegate).readDataFrame(streamId, false, buf.slice(SPDY_HEADER_SIZE, length));
Mockito.verify(delegate).readDataFrame(streamId, false, buf.slice(SPDY_HEADER_SIZE, length));
assertFalse(buf.isReadable());
buf.release();
}
@ -180,7 +177,7 @@ public class SpdyFrameDecoderTest {
encodeDataFrameHeader(buf, streamId, flags, length);
decoder.decode(buf);
verify(delegate).readDataFrame(streamId, false, Unpooled.EMPTY_BUFFER);
Mockito.verify(delegate).readDataFrame(streamId, false, Unpooled.EMPTY_BUFFER);
assertFalse(buf.isReadable());
buf.release();
}
@ -195,7 +192,7 @@ public class SpdyFrameDecoderTest {
encodeDataFrameHeader(buf, streamId, flags, length);
decoder.decode(buf);
verify(delegate).readDataFrame(streamId, true, Unpooled.EMPTY_BUFFER);
Mockito.verify(delegate).readDataFrame(streamId, true, Unpooled.EMPTY_BUFFER);
assertFalse(buf.isReadable());
buf.release();
}
@ -210,7 +207,7 @@ public class SpdyFrameDecoderTest {
encodeDataFrameHeader(buf, streamId, flags, length);
decoder.decode(buf);
verify(delegate).readDataFrame(streamId, false, Unpooled.EMPTY_BUFFER);
Mockito.verify(delegate).readDataFrame(streamId, false, Unpooled.EMPTY_BUFFER);
assertFalse(buf.isReadable());
buf.release();
}
@ -225,7 +222,7 @@ public class SpdyFrameDecoderTest {
encodeDataFrameHeader(buf, streamId, flags, length);
decoder.decode(buf);
verify(delegate).readFrameError((String) any());
Mockito.verify(delegate).readFrameError((String) ArgumentMatchers.any());
assertFalse(buf.isReadable());
buf.release();
}
@ -242,8 +239,8 @@ public class SpdyFrameDecoderTest {
encodeDataFrameHeader(buf, streamId2, flags, length);
decoder.decode(buf);
verify(delegate).readDataFrame(streamId1, false, Unpooled.EMPTY_BUFFER);
verify(delegate).readDataFrame(streamId2, false, Unpooled.EMPTY_BUFFER);
Mockito.verify(delegate).readDataFrame(streamId1, false, Unpooled.EMPTY_BUFFER);
Mockito.verify(delegate).readDataFrame(streamId2, false, Unpooled.EMPTY_BUFFER);
assertFalse(buf.isReadable());
buf.release();
}
@ -265,8 +262,8 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0);
decoder.decode(buf);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -288,8 +285,8 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0);
decoder.decode(buf);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, true, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, true, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -311,8 +308,8 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0);
decoder.decode(buf);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, true);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, true);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -334,8 +331,8 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0);
decoder.decode(buf);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -357,8 +354,8 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0);
decoder.decode(buf);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -380,8 +377,8 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0xFF); // should ignore reserved bits
decoder.decode(buf);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -400,7 +397,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(associatedToStreamId);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -422,7 +419,7 @@ public class SpdyFrameDecoderTest {
buf.writeByte(0);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -451,9 +448,9 @@ public class SpdyFrameDecoderTest {
decoder.decode(buf);
decoder.decode(headerBlock);
verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
verify(delegate).readHeaderBlock(headerBlock.slice(0, headerBlock.writerIndex()));
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynStreamFrame(streamId, associatedToStreamId, priority, false, false);
Mockito.verify(delegate).readHeaderBlock(headerBlock.slice(0, headerBlock.writerIndex()));
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
assertFalse(headerBlock.isReadable());
buf.release();
@ -472,8 +469,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readSynReplyFrame(streamId, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynReplyFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -490,8 +487,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readSynReplyFrame(streamId, true);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynReplyFrame(streamId, true);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -508,8 +505,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readSynReplyFrame(streamId, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynReplyFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -526,8 +523,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId | 0x80000000); // should ignore reserved bit
decoder.decode(buf);
verify(delegate).readSynReplyFrame(streamId, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynReplyFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
@ -543,7 +540,7 @@ public class SpdyFrameDecoderTest {
encodeControlFrameHeader(buf, type, flags, length);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -560,7 +557,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -584,9 +581,9 @@ public class SpdyFrameDecoderTest {
decoder.decode(buf);
decoder.decode(headerBlock);
verify(delegate).readSynReplyFrame(streamId, false);
verify(delegate).readHeaderBlock(headerBlock.slice(0, headerBlock.writerIndex()));
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readSynReplyFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlock(headerBlock.slice(0, headerBlock.writerIndex()));
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
assertFalse(headerBlock.isReadable());
buf.release();
@ -607,7 +604,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readRstStreamFrame(streamId, statusCode);
Mockito.verify(delegate).readRstStreamFrame(streamId, statusCode);
assertFalse(buf.isReadable());
buf.release();
}
@ -626,7 +623,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readRstStreamFrame(streamId, statusCode);
Mockito.verify(delegate).readRstStreamFrame(streamId, statusCode);
assertFalse(buf.isReadable());
buf.release();
}
@ -645,7 +642,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -664,7 +661,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -683,7 +680,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -702,7 +699,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -728,8 +725,8 @@ public class SpdyFrameDecoderTest {
delegate.readSettingsEnd();
decoder.decode(buf);
verify(delegate).readSettingsFrame(false);
verify(delegate, times(numSettings)).readSetting(id, value, false, false);
Mockito.verify(delegate).readSettingsFrame(false);
Mockito.verify(delegate, Mockito.times(numSettings)).readSetting(id, value, false, false);
assertFalse(buf.isReadable());
buf.release();
}
@ -746,8 +743,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(numSettings);
decoder.decode(buf);
verify(delegate).readSettingsFrame(false);
verify(delegate).readSettingsEnd();
Mockito.verify(delegate).readSettingsFrame(false);
Mockito.verify(delegate).readSettingsEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -764,8 +761,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(numSettings);
decoder.decode(buf);
verify(delegate).readSettingsFrame(true);
verify(delegate).readSettingsEnd();
Mockito.verify(delegate).readSettingsFrame(true);
Mockito.verify(delegate).readSettingsEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -791,8 +788,8 @@ public class SpdyFrameDecoderTest {
delegate.readSettingsEnd();
decoder.decode(buf);
verify(delegate).readSettingsFrame(false);
verify(delegate, times(numSettings)).readSetting(id, value, true, false);
Mockito.verify(delegate).readSettingsFrame(false);
Mockito.verify(delegate, Mockito.times(numSettings)).readSetting(id, value, true, false);
assertFalse(buf.isReadable());
buf.release();
}
@ -818,8 +815,8 @@ public class SpdyFrameDecoderTest {
delegate.readSettingsEnd();
decoder.decode(buf);
verify(delegate).readSettingsFrame(false);
verify(delegate, times(numSettings)).readSetting(id, value, false, true);
Mockito.verify(delegate).readSettingsFrame(false);
Mockito.verify(delegate, Mockito.times(numSettings)).readSetting(id, value, false, true);
assertFalse(buf.isReadable());
buf.release();
}
@ -836,8 +833,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(numSettings);
decoder.decode(buf);
verify(delegate).readSettingsFrame(false);
verify(delegate).readSettingsEnd();
Mockito.verify(delegate).readSettingsFrame(false);
Mockito.verify(delegate).readSettingsEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -863,8 +860,8 @@ public class SpdyFrameDecoderTest {
delegate.readSettingsEnd();
decoder.decode(buf);
verify(delegate).readSettingsFrame(false);
verify(delegate, times(numSettings)).readSetting(id, value, false, false);
Mockito.verify(delegate).readSettingsFrame(false);
Mockito.verify(delegate, Mockito.times(numSettings)).readSetting(id, value, false, false);
assertFalse(buf.isReadable());
buf.release();
}
@ -889,7 +886,7 @@ public class SpdyFrameDecoderTest {
}
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -914,7 +911,7 @@ public class SpdyFrameDecoderTest {
}
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -988,7 +985,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(id);
decoder.decode(buf);
verify(delegate).readPingFrame(id);
Mockito.verify(delegate).readPingFrame(id);
assertFalse(buf.isReadable());
buf.release();
}
@ -1005,7 +1002,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(id);
decoder.decode(buf);
verify(delegate).readPingFrame(id);
Mockito.verify(delegate).readPingFrame(id);
assertFalse(buf.isReadable());
buf.release();
}
@ -1022,7 +1019,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(id);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -1041,7 +1038,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readGoAwayFrame(lastGoodStreamId, statusCode);
Mockito.verify(delegate).readGoAwayFrame(lastGoodStreamId, statusCode);
assertFalse(buf.isReadable());
buf.release();
}
@ -1060,7 +1057,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readGoAwayFrame(lastGoodStreamId, statusCode);
Mockito.verify(delegate).readGoAwayFrame(lastGoodStreamId, statusCode);
assertFalse(buf.isReadable());
buf.release();
}
@ -1079,7 +1076,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readGoAwayFrame(lastGoodStreamId, statusCode);
Mockito.verify(delegate).readGoAwayFrame(lastGoodStreamId, statusCode);
assertFalse(buf.isReadable());
buf.release();
}
@ -1098,7 +1095,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(statusCode);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -1115,8 +1112,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readHeadersFrame(streamId, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readHeadersFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -1133,8 +1130,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readHeadersFrame(streamId, true);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readHeadersFrame(streamId, true);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -1151,8 +1148,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readHeadersFrame(streamId, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readHeadersFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -1169,8 +1166,8 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId | 0x80000000); // should ignore reserved bit
decoder.decode(buf);
verify(delegate).readHeadersFrame(streamId, false);
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readHeadersFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
buf.release();
}
@ -1185,7 +1182,7 @@ public class SpdyFrameDecoderTest {
encodeControlFrameHeader(buf, type, flags, length);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -1202,7 +1199,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(streamId);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -1225,9 +1222,9 @@ public class SpdyFrameDecoderTest {
}
decoder.decode(buf);
decoder.decode(headerBlock);
verify(delegate).readHeadersFrame(streamId, false);
verify(delegate).readHeaderBlock(headerBlock.slice(0, headerBlock.writerIndex()));
verify(delegate).readHeaderBlockEnd();
Mockito.verify(delegate).readHeadersFrame(streamId, false);
Mockito.verify(delegate).readHeaderBlock(headerBlock.slice(0, headerBlock.writerIndex()));
Mockito.verify(delegate).readHeaderBlockEnd();
assertFalse(buf.isReadable());
assertFalse(headerBlock.isReadable());
buf.release();
@ -1248,7 +1245,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(deltaWindowSize);
decoder.decode(buf);
verify(delegate).readWindowUpdateFrame(streamId, deltaWindowSize);
Mockito.verify(delegate).readWindowUpdateFrame(streamId, deltaWindowSize);
assertFalse(buf.isReadable());
}
@ -1266,7 +1263,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(deltaWindowSize);
decoder.decode(buf);
verify(delegate).readWindowUpdateFrame(streamId, deltaWindowSize);
Mockito.verify(delegate).readWindowUpdateFrame(streamId, deltaWindowSize);
assertFalse(buf.isReadable());
buf.release();
}
@ -1285,7 +1282,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(deltaWindowSize | 0x80000000); // should ignore reserved bit
decoder.decode(buf);
verify(delegate).readWindowUpdateFrame(streamId, deltaWindowSize);
Mockito.verify(delegate).readWindowUpdateFrame(streamId, deltaWindowSize);
assertFalse(buf.isReadable());
buf.release();
}
@ -1304,7 +1301,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(deltaWindowSize);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}
@ -1323,7 +1320,7 @@ public class SpdyFrameDecoderTest {
buf.writeInt(deltaWindowSize);
decoder.decode(buf);
verify(delegate).readFrameError(anyString());
Mockito.verify(delegate).readFrameError(ArgumentMatchers.anyString());
assertFalse(buf.isReadable());
buf.release();
}

View file

@ -0,0 +1,7 @@
handlers=java.util.logging.ConsoleHandler
.level=ALL
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s [%3$s] %5$s %6$s%n
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
jdk.event.security.level=INFO
org.junit.jupiter.engine.execution.ConditionEvaluator.level=OFF

View file

@ -12,6 +12,8 @@ module org.xbib.io.netty.util {
org.xbib.io.netty.handler.codec.http,
org.xbib.io.netty.handler.codec.httptwo,
org.xbib.io.netty.handler.codec.protobuf,
org.xbib.io.netty.handler.codec.rtsp,
org.xbib.io.netty.handler.codec.spdy,
org.xbib.io.netty.handler.ssl,
org.xbib.io.netty.resolver;
exports io.netty.util.internal.logging to
@ -24,6 +26,8 @@ module org.xbib.io.netty.util {
org.xbib.io.netty.handler.codec.http,
org.xbib.io.netty.handler.codec.httptwo,
org.xbib.io.netty.handler.codec.protobuf,
org.xbib.io.netty.handler.codec.rtsp,
org.xbib.io.netty.handler.codec.spdy,
org.xbib.io.netty.handler.ssl,
org.xbib.io.netty.resolver;
requires org.xbib.io.netty.jctools;

View file

@ -20,7 +20,6 @@ dependencyResolutionManagement {
library('bouncycastle', 'org.bouncycastle', 'bcpkix-jdk18on').version('1.77')
library('conscrypt', 'org.conscrypt', 'conscrypt-openjdk-uber').version('2.5.2')
library('brotli4j', 'com.aayushatharva.brotli4j', 'brotli4j').versionRef('brotli4j')
library('jzlib', 'com.jcraft', 'jzlib').version('1.1.3')
library('lz4', 'org.lz4', 'lz4-java').version('1.8.0')
library('lzf', 'com.ning', 'compress-lzf').version('1.1.2')
library('zstd', 'com.github.luben', 'zstd-jni').version('1.5.5-11')
@ -68,6 +67,8 @@ include 'netty-handler-codec-compression'
include 'netty-handler-codec-http'
include 'netty-handler-codec-http2'
include 'netty-handler-codec-protobuf'
include 'netty-handler-codec-rtsp'
include 'netty-handler-codec-spdy'
include 'netty-handler-ssl'
include 'netty-internal-tcnative'
include 'netty-resolver'