@Test public void testSniForceShortname() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST1) .address(SocketAddress.inetSocketAddress(4043, "host1")) .serverName("host1") .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("host1", cnOf(test.clientPeerCert())); }
@Test public void testSniImplicitServerNameDisabledForShortname1() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST1) .address(SocketAddress.inetSocketAddress(4043, "host1")) .serverCert(Cert.SNI_JKS).sni(true); test.run(false); await(); }
@Test public void testSniImplicitServerName() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST2) .address(SocketAddress.inetSocketAddress(4043, "host2.com")) .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("host2.com", cnOf(test.clientPeerCert())); assertEquals("host2.com", test.indicatedServerName); }
@Test public void testSniOverrideServerName() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST2) .address(SocketAddress.inetSocketAddress(4043, "example.com")) .serverName("host2.com") .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("host2.com", cnOf(test.clientPeerCert())); }
@Test public void testSniImplicitServerNameDisabledForShortname2() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SERVER_JKS) .address(SocketAddress.inetSocketAddress(4043, "host1")) .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("localhost", cnOf(test.clientPeerCert())); }
@Test public void testSniForceShortname() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST1) .address(SocketAddress.inetSocketAddress(4043, "host1")) .serverName("host1") .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("host1", cnOf(test.clientPeerCert())); }
@Test public void testSniImplicitServerNameDisabledForShortname2() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SERVER_JKS) .address(SocketAddress.inetSocketAddress(4043, "host1")) .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("localhost", cnOf(test.clientPeerCert())); }
@Test public void testSniImplicitServerNameDisabledForShortname1() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST1) .address(SocketAddress.inetSocketAddress(4043, "host1")) .serverCert(Cert.SNI_JKS).sni(true); test.run(false); await(); }
@Test public void testSniOverrideServerName() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST2) .address(SocketAddress.inetSocketAddress(4043, "example.com")) .serverName("host2.com") .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("host2.com", cnOf(test.clientPeerCert())); }
@Test public void testSniImplicitServerName() throws Exception { TLSTest test = new TLSTest() .clientTrust(Trust.SNI_JKS_HOST2) .address(SocketAddress.inetSocketAddress(4043, "host2.com")) .serverCert(Cert.SNI_JKS).sni(true); test.run(true); await(); assertEquals("host2.com", cnOf(test.clientPeerCert())); assertEquals("host2.com", test.indicatedServerName); }