final WicketTester tester = new WicketTester(application);
ThreadContext.setApplication(application);
HttpsRequestChecker checker = new HttpsRequestChecker();
IPageRequestHandler httpsPageRequestHandler = Mockito.mock(IPageRequestHandler.class);
Mockito.doReturn(HttpsPage.class).when(httpsPageRequestHandler).getPageClass();
HttpsConfig httpsConfig = new HttpsConfig();
IRequestHandler httpsPageSecureIncoming = checker.checkSecureIncoming(
httpsPageRequestHandler, httpsConfig);
assertTrue(httpsPageSecureIncoming instanceof SwitchProtocolRequestHandler);
IPageRequestHandler httpPageRequestHandler = Mockito.mock(IPageRequestHandler.class);
Mockito.doReturn(HttpPage.class).when(httpsPageRequestHandler).getPageClass();
IRequestHandler httpPageSecureIncoming = checker.checkSecureIncoming(
httpPageRequestHandler, httpsConfig);
assertSame(httpPageRequestHandler, httpPageSecureIncoming);