use of org.webpieces.ssl.api.dto.SslAction in project webpieces by deanhiller.
the class TestSslCloseClient method testBasicCloseFromClient.
// @Test
public void testBasicCloseFromClient() throws GeneralSecurityException, IOException, InterruptedException, ExecutionException, TimeoutException {
XFuture<Void> future = channel.close();
Assert.assertTrue(future.isDone());
DataWrapper payload = mockChannel.nextPayload();
XFuture<List<SslAction>> resultFuture2 = svrSslParser.parseIncoming(payload);
List<SslAction> result2 = resultFuture2.get(2, TimeUnit.SECONDS);
Assert.assertEquals(2, result2.size());
Assert.assertEquals(SslActionEnum.SEND_TO_SOCKET, result2.get(0).getSslAction());
Assert.assertEquals(SslActionEnum.SEND_LINK_CLOSED_TO_APP, result2.get(1).getSslAction());
mockChannel.forceDataRead(mockJdk, result2.get(0).getEncryptedData());
future.get(2, TimeUnit.SECONDS);
}
use of org.webpieces.ssl.api.dto.SslAction in project webpieces by deanhiller.
the class TestSslCloseClient method testBothEndsAtSameTime.
// @Test
public void testBothEndsAtSameTime() throws InterruptedException, ExecutionException, TimeoutException {
XFuture<Void> future = channel.close();
SslAction action = svrSslParser.close();
Assert.assertEquals(SslActionEnum.SEND_TO_SOCKET, action.getSslAction());
Assert.assertTrue(future.isDone());
mockChannel.forceDataRead(mockJdk, action.getEncryptedData());
future.get(2, TimeUnit.SECONDS);
SslAction action2 = parseIncoming();
Assert.assertEquals(SslActionEnum.LINK_SUCCESSFULLY_CLOSED, action2.getSslAction());
// far end closed should NOT be called...
Assert.assertFalse(mockClientDataListener.isClosed());
}
Aggregations