use of io.netty.handler.codec.DecoderResult in project netty by netty.
the class DefaultSocks5PasswordAuthResponse method toString.
@Override
public String toString() {
StringBuilder buf = new StringBuilder(StringUtil.simpleClassName(this));
DecoderResult decoderResult = decoderResult();
if (!decoderResult.isSuccess()) {
buf.append("(decoderResult: ");
buf.append(decoderResult);
buf.append(", status: ");
} else {
buf.append("(status: ");
}
buf.append(status());
buf.append(')');
return buf.toString();
}
use of io.netty.handler.codec.DecoderResult in project netty by netty.
the class DefaultSocks5CommandRequest method toString.
@Override
public String toString() {
StringBuilder buf = new StringBuilder(128);
buf.append(StringUtil.simpleClassName(this));
DecoderResult decoderResult = decoderResult();
if (!decoderResult.isSuccess()) {
buf.append("(decoderResult: ");
buf.append(decoderResult);
buf.append(", type: ");
} else {
buf.append("(type: ");
}
buf.append(type());
buf.append(", dstAddrType: ");
buf.append(dstAddrType());
buf.append(", dstAddr: ");
buf.append(dstAddr());
buf.append(", dstPort: ");
buf.append(dstPort());
buf.append(')');
return buf.toString();
}
use of io.netty.handler.codec.DecoderResult in project netty by netty.
the class DefaultSocks5InitialRequest method toString.
@Override
public String toString() {
StringBuilder buf = new StringBuilder(StringUtil.simpleClassName(this));
DecoderResult decoderResult = decoderResult();
if (!decoderResult.isSuccess()) {
buf.append("(decoderResult: ");
buf.append(decoderResult);
buf.append(", authMethods: ");
} else {
buf.append("(authMethods: ");
}
buf.append(authMethods());
buf.append(')');
return buf.toString();
}
use of io.netty.handler.codec.DecoderResult in project netty by netty.
the class HttpInvalidMessageTest method testBadChunk.
@Test
public void testBadChunk() throws Exception {
EmbeddedChannel ch = new EmbeddedChannel(new HttpRequestDecoder());
ch.writeInbound(Unpooled.copiedBuffer("GET / HTTP/1.0\r\n", CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer("Transfer-Encoding: chunked\r\n\r\n", CharsetUtil.UTF_8));
ch.writeInbound(Unpooled.copiedBuffer("BAD_LENGTH\r\n", CharsetUtil.UTF_8));
HttpRequest req = ch.readInbound();
assertTrue(req.decoderResult().isSuccess());
LastHttpContent chunk = ch.readInbound();
DecoderResult dr = chunk.decoderResult();
assertFalse(dr.isSuccess());
assertTrue(dr.isFailure());
ensureInboundTrafficDiscarded(ch);
}
use of io.netty.handler.codec.DecoderResult in project netty by netty.
the class HttpInvalidMessageTest method testRequestWithBadInitialLine.
@Test
public void testRequestWithBadInitialLine() throws Exception {
EmbeddedChannel ch = new EmbeddedChannel(new HttpRequestDecoder());
ch.writeInbound(Unpooled.copiedBuffer("GET / HTTP/1.0 with extra\r\n", CharsetUtil.UTF_8));
HttpRequest req = ch.readInbound();
DecoderResult dr = req.decoderResult();
assertFalse(dr.isSuccess());
assertTrue(dr.isFailure());
ensureInboundTrafficDiscarded(ch);
}
Aggregations