Search in sources :

Example 1 with EzyHandShakeResponse

use of com.tvd12.ezyfoxserver.response.EzyHandShakeResponse in project ezyfox-server by youngmonkeys.

the class EzyHandshakeController method newHandShakeResponse.

protected EzyResponse newHandShakeResponse(EzySession session, EzyHandshakeEvent event) {
    EzyHandShakeParams params = new EzyHandShakeParams();
    params.setServerPublicKey(session.getPublicKey());
    params.setReconnectToken(session.getToken());
    params.setSessionId(session.getId());
    params.setSessionKey(event.getEncryptedSessionKey());
    return new EzyHandShakeResponse(params);
}
Also used : EzyHandShakeResponse(com.tvd12.ezyfoxserver.response.EzyHandShakeResponse) EzyHandShakeParams(com.tvd12.ezyfoxserver.response.EzyHandShakeParams)

Example 2 with EzyHandShakeResponse

use of com.tvd12.ezyfoxserver.response.EzyHandShakeResponse in project ezyfox-server by youngmonkeys.

the class EzyHandShakeResponseTest method test.

@Test
public void test() {
    EzyHandShakeParams params = new EzyHandShakeParams();
    params.setReconnectToken("123");
    params.setServerPublicKey(new byte[0]);
    params.setSessionId(1L);
    params.setSessionKey(EzyAesCrypt.randomKey());
    assert params.getSessionId() == 1L;
    assert params.getReconnectToken().equals("123");
    assert params.getServerPublicKey().length == 0;
    assert params.getSessionKey() != null;
    EzyHandShakeResponse response = new EzyHandShakeResponse(params);
    response.serialize();
    params.setServerPublicKey(null);
    response.serialize();
    response.release();
}
Also used : EzyHandShakeResponse(com.tvd12.ezyfoxserver.response.EzyHandShakeResponse) EzyHandShakeParams(com.tvd12.ezyfoxserver.response.EzyHandShakeParams) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

EzyHandShakeParams (com.tvd12.ezyfoxserver.response.EzyHandShakeParams)2 EzyHandShakeResponse (com.tvd12.ezyfoxserver.response.EzyHandShakeResponse)2 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1