use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInet4BeginExtensionSecureProtocol.
@Test(expected = Exception.class)
public void shouldNotMatchInet4BeginExtensionSecureProtocol() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).info().secure().version("TLSv1.2").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.version("TLSv1.3"))).build();
assertNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchInetBeginExtension.
@Test
public void shouldMatchInetBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet().source("*").destination("example.com").sourcePort(32768).destinationPort(443).build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").build().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.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchInet4BeginExtension.
@Test
public void shouldMatchInet4BeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressInet4().source("192.168.0.1").destination("192.168.0.254").sourcePort(32768).destinationPort(443).build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").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.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION in project zilla by aklivity.
the class ProxyFunctionsTest method shouldMatchNoneBeginExtension.
@Test
public void shouldMatchNoneBeginExtension() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).addressNone().build().info().alpn("echo").authority("example.com").identity(fromHex("12345678")).namespace("example").secure().version("TLSv1.3").cipher("ECDHE-RSA-AES128-GCM-SHA256").signature("SHA256").name("name@domain").key("RSA2048").build().build().build();
ByteBuffer byteBuf = ByteBuffer.allocate(1024);
new ProxyBeginExFW.Builder().wrap(new UnsafeBuffer(byteBuf), 0, byteBuf.capacity()).typeId(0x01).address(a -> a.none(n -> {
})).infosItem(i -> i.alpn("echo")).infosItem(i -> i.authority("example.com")).infosItem(i -> i.identity(id -> id.value(v -> v.set(fromHex("12345678"))))).infosItem(i -> i.namespace("example")).infosItem(i -> i.secure(s -> s.version("TLSv1.3"))).infosItem(i -> i.secure(s -> s.cipher("ECDHE-RSA-AES128-GCM-SHA256"))).infosItem(i -> i.secure(s -> s.signature("SHA256"))).infosItem(i -> i.secure(s -> s.name("name@domain"))).infosItem(i -> i.secure(s -> s.key("RSA2048"))).build();
assertNotNull(matcher.match(byteBuf));
}
use of io.aklivity.zilla.specs.binding.proxy.internal.types.ProxySecureInfoType.VERSION in project zilla by aklivity.
the class ProxyFunctionsTest method shouldNotMatchInetBeginExtensionSecureProtocol.
@Test(expected = Exception.class)
public void shouldNotMatchInetBeginExtensionSecureProtocol() throws Exception {
BytesMatcher matcher = ProxyFunctions.matchBeginEx().typeId(0x01).info().secure().version("TLSv1.2").build().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.secure(s -> s.version("TLSv1.3"))).build();
assertNull(matcher.match(byteBuf));
}
Aggregations