use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet6BeginExtensionDestination.
@Test(expected = Exception.class)
public void shouldNotMatchInet6BeginExtensionDestination() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet6().destination("fd12:3456:789a:1::fd").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 io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInetBeginExtensionAuthority.
@Test(expected = Exception.class)
public void shouldNotMatchInetBeginExtensionAuthority() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).info().authority("example.net").build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).infosItem(i -> i.authority("example.com")).build();
assertNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchInet4BeginExtensionProtocol.
@Test
public void shouldMatchInet4BeginExtensionProtocol() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet4().protocol("stream").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();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet6BeginExtensionSourcePort.
@Test(expected = Exception.class)
public void shouldNotMatchInet6BeginExtensionSourcePort() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet6().sourcePort(32767).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 io.aklivity.zilla.specs.binding.proxy.internal.types.ProxyAddressProtocol.STREAM in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInetBeginExtensionSourcePort.
@Test(expected = Exception.class)
public void shouldNotMatchInetBeginExtensionSourcePort() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().sourcePort(32767).build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.inet(i -> i.protocol(p -> p.set(STREAM)).source("*").destination("example.com").sourcePort(32768).destinationPort(443))).build();
assertNull(matcher.match(byteBuf));
}
Aggregations