private void startOfHandshake(SSLEngine client, SSLEngine server, ByteBuffer unencrPacket, ByteBuffer encPacket) throws SSLException {
		client.beginHandshake();
			
		SSLEngineResult result = client.wrap(unencrPacket, encPacket);
		assertEquals(result.getHandshakeStatus(), HandshakeStatus.NEED_UNWRAP);
		assertEquals(result.getStatus(), Status.OK);
		
		encPacket.flip();
		
		result = server.unwrap(encPacket, unencrPacket);
		
		assertEquals(HandshakeStatus.NEED_TASK, result.getHandshakeStatus());
		assertEquals(Status.OK, result.getStatus());
		Runnable r = server.getDelegatedTask();
		r.run();
		
		assertEquals(HandshakeStatus.NEED_WRAP, server.getHandshakeStatus());
		encPacket.clear();
		result = server.wrap(unencrPacket, encPacket);
		assertEquals(HandshakeStatus.NEED_UNWRAP, result.getHandshakeStatus());
		assertEquals(Status.OK, result.getStatus());		
		
		encPacket.flip();
		result = client.unwrap(encPacket, unencrPacket);		
		assertEquals(HandshakeStatus.NEED_TASK, result.getHandshakeStatus());
		assertEquals(Status.OK, result.getStatus());
		r = client.getDelegatedTask();
		r.run();
		assertEquals(HandshakeStatus.NEED_WRAP, client.getHandshakeStatus());
		
		encPacket.clear();
		result = client.wrap(unencrPacket, encPacket);
		assertEquals(HandshakeStatus.NEED_WRAP, result.getHandshakeStatus());
		assertEquals(Status.OK, result.getStatus());

		encPacket.flip();
		result = server.unwrap(encPacket, unencrPacket);
		assertEquals(HandshakeStatus.NEED_TASK, result.getHandshakeStatus());
		assertEquals(Status.OK, result.getStatus());		
		r = server.getDelegatedTask();
		r.run();
		assertEquals(HandshakeStatus.NEED_UNWRAP, server.getHandshakeStatus());
	}