### Question:
RapidoidTLS extends RapidoidThing { public SSLEngine engine() { return engine; } RapidoidTLS(SSLContext sslContext, RapidoidConnection conn, TLSParams tlsParams); boolean isClosed(); SSLSession getSession(); synchronized boolean unwrapInput(); synchronized boolean wrapToOutgoing(); synchronized SSLEngineResult wrap(ByteBuffer src, ByteBuffer dst); synchronized SSLEngineResult unwrap(ByteBuffer src, ByteBuffer dst); SSLEngine engine(); synchronized void closeInbound(); void reset(); final ByteBuffer netIn; }### Answer:
@Test public void testNeedClientAuth() throws NoSuchAlgorithmException, KeyManagementException { SSLContext context = SSLContext.getDefault(); TLSParams tlsParams = new TLSParams(); tlsParams.needClientAuth(true); RapidoidTLS tls = new RapidoidTLS(context, null, tlsParams); isTrue(tls.engine().getNeedClientAuth()); isFalse(tls.engine().getWantClientAuth()); }
@Test public void testWantClientAuth() throws NoSuchAlgorithmException, KeyManagementException { SSLContext context = SSLContext.getDefault(); TLSParams tlsParams = new TLSParams(); tlsParams.wantClientAuth(true); RapidoidTLS tls = new RapidoidTLS(context, null, tlsParams); isTrue(tls.engine().getWantClientAuth()); isFalse(tls.engine().getNeedClientAuth()); }
@Test public void testNoClientAuth() throws NoSuchAlgorithmException, KeyManagementException { SSLContext context = SSLContext.getDefault(); TLSParams tlsParams = new TLSParams(); RapidoidTLS tls = new RapidoidTLS(context, null, tlsParams); isFalse(tls.engine().getNeedClientAuth()); isFalse(tls.engine().getWantClientAuth()); }