use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet6BeginExtensionDestinationPort.
@Test(expected = Exception.class)
public void shouldNotMatchInet6BeginExtensionDestinationPort() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet6().destinationPort(444).build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet6(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("fd123456789a00010000000000000001")), 0, 16).destination(new UnsafeBuffer(fromHex("fd123456789a000100000000000000fe")), 0, 16).sourcePort(32768).destinationPort(443))).build();
assertNull(matcher.match(byteBuf));
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchNoneBeginExtension.
@Test(expected = Exception.class)
public void shouldNotMatchNoneBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressNone().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet4(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("c0a80001")), 0, 4).destination(new UnsafeBuffer(fromHex("c0a800fe")), 0, 4).sourcePort(32768).destinationPort(443))).build();
assertNull(matcher.match(byteBuf));
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet4BeginExtensionSource.
@Test(expected = Exception.class)
public void shouldNotMatchInet4BeginExtensionSource() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet4().source("192.168.0.2").build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet4(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("c0a80001")), 0, 4).destination(new UnsafeBuffer(fromHex("c0a800fe")), 0, 4).sourcePort(32768).destinationPort(443))).build();
assertNull(matcher.match(byteBuf));
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchUnixBeginExtensionDestination.
@Test(expected = Exception.class)
public void shouldNotMatchUnixBeginExtensionDestination() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressUnix().destination("destination-56789").build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.unix(i -> i.protocol(p -> p.set(STREAM)).source(paddedUtf8("source-1234", 108), 0, 108).destination(paddedUtf8("destination-5678", 108), 0, 108))).build();
assertNull(matcher.match(byteBuf));
}
use of org.kaazing.k3po.lang.el.BytesMatcher in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet4BeginExtensionSecureSignature.
@Test(expected = Exception.class)
public void shouldNotMatchInet4BeginExtensionSecureSignature() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).info().secure().signature("SHA257").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet4(i -> i.protocol(p -> p.set(STREAM)).source(new UnsafeBuffer(fromHex("c0a80001")), 0, 4).destination(new UnsafeBuffer(fromHex("c0a800fe")), 0, 4).sourcePort(32768).destinationPort(443))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).build();
assertNull(matcher.match(byteBuf));
}
Aggregations