public static IncomingMessageHandler createSpecificHandler(byte[] data, Type type) {
        try {

            switch (type) {

                case CLOGIN:
                    return new AuthorisationHandler(data);

                case CNEWGAME:
                    return new NewGameRequestHandler(data);

                case CNEWTURN:
                    return new PlayerTurnHandler(data);

                case CINTERRUPT:
                    return new InterruptHandler(data);

                case CCONTINUE:
                    return new ContinueGameHandler(data);

                case CPARTNERINFO:
                    return new PartnerInfoRequestHandler(data);

                case CLOGOUT:
                    return new LogoutHandler(data);


                default:
                    System.out.println("Unable to create instance in factory, type: " + type);
                    return null;
            }
        } catch (InvalidProtocolBufferException e) {
            e.printStackTrace();
            return null;
        }
    }