public SocketClientInstance( ObjectChannel objectSocket, ClientServiceRegistryImpl csr, boolean isClientEncryptionEnabled) { this.objectSocket = objectSocket; this.csr = csr; this.workContext.setSecurityHelper(csr.getSecurityHelper()); this.usingEncryption = isClientEncryptionEnabled; SocketAddress address = this.objectSocket.getRemoteAddress(); if (address instanceof InetSocketAddress) { InetSocketAddress addr = (InetSocketAddress) address; this.workContext.setClientAddress(addr.getAddress().getHostAddress()); this.workContext.setClientHostname(addr.getHostName()); } }
public void onConnection() throws CommunicationException { Handshake handshake = new Handshake(); handshake.setAuthType(csr.getAuthenticationType()); if (usingEncryption) { keyGen = new DhKeyGenerator(); byte[] publicKey; try { publicKey = keyGen.createPublicKey(); } catch (CryptoException e) { throw new CommunicationException(RuntimePlugin.Event.TEIID40051, e); } handshake.setPublicKey(publicKey); } this.objectSocket.write(handshake); }