private void receivedHahdshake(Handshake handshake) throws CommunicationException { String clientVersion = handshake.getVersion(); this.workContext.setClientVersion(Version.getVersion(clientVersion)); if (usingEncryption) { byte[] returnedPublicKey = handshake.getPublicKey(); byte[] returnedPublicKeyLarge = handshake.getPublicKeyLarge(); boolean large = false; //ensure the key information if (returnedPublicKey == null) { if (returnedPublicKeyLarge == null) { throw new CommunicationException(RuntimePlugin.Event.TEIID40052, RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40052)); } large = true; returnedPublicKey = returnedPublicKeyLarge; } if (LogManager.isMessageToBeRecorded(LogConstants.CTX_TRANSPORT, MessageLevel.DETAIL)) { LogManager.logDetail(LogConstants.CTX_TRANSPORT, large?"2048":"1024", "key exchange being used."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } boolean useCbc = handshake.isCbc(); try { this.cryptor = keyGen.getSymmetricCryptor(returnedPublicKey, "08.03".compareTo(clientVersion) > 0, SocketClientInstance.class.getClassLoader(), large, useCbc); //$NON-NLS-1$ } catch (CryptoException e) { throw new CommunicationException(RuntimePlugin.Event.TEIID40053, e); } this.keyGen = null; } else { this.cryptor = new NullCryptor(); } }
this.cryptor = keyGen.getSymmetricCryptor(serverPublicKey, "08.03".compareTo(serverVersion) > 0, this.getClass().getClassLoader(), large, useCbc); //$NON-NLS-1$ } else { this.cryptor = new NullCryptor();
this.cryptor = keyGen.getSymmetricCryptor(serverPublicKey, "08.03".compareTo(serverVersion) > 0, this.getClass().getClassLoader(), large, useCbc); //$NON-NLS-1$ } else { this.cryptor = new NullCryptor();
@Override public SocketServerInstance getServerInstance(HostInfo info) throws CommunicationException, IOException { SocketServerInstance instance = Mockito.mock(SocketServerInstance.class); Mockito.stub(instance.getCryptor()).toReturn(new NullCryptor()); Mockito.stub(instance.getHostInfo()).toReturn(hostInfo); Mockito.stub(instance.getService(ILogon.class)).toReturn(logon); Mockito.stub(instance.getServerVersion()).toReturn("07.03"); if (t != null) { try { Mockito.doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { if (logon.t == null) { return null; } throw logon.t; } }).when(instance).send((Message)Mockito.anyObject(), (ResultsReceiver<Object>)Mockito.anyObject(), (Serializable)Mockito.anyObject()); } catch (Exception e) { } } Mockito.stub(instance.isOpen()).toReturn(true); return instance; }