if (localHash.equals(request.serverHash)) { response.match = remote == null ? HandshakeMatch.NONE : HandshakeMatch.BOTH;
public void testRoundtripAvroWithHandShakeRequest() { String className = "java=org.apache.avro.ipc.HandshakeRequest"; HandshakeRequest req = new HandshakeRequest(); // set a few values to avoid NPEs req.clientHash = new MD5(); req.clientProtocol = new Utf8(""); req.serverHash = new MD5(); AvroSpecificSerializer<HandshakeRequest> serializer = new AvroSpecificSerializer<HandshakeRequest>(className); byte[] bytes = serializer.toBytes(req); byte[] bytes2 = serializer.toBytes(req); assertEquals(ByteUtils.compare(bytes, bytes2), 0); assertTrue(serializer.toObject(bytes).equals(req)); assertTrue(serializer.toObject(bytes2).equals(req)); } }
} else { out.writeIndex(1); out.writeFixed(this.serverHash.bytes(), 0, 16);
if (fieldOrder == null) { if (this.clientHash == null) { this.clientHash = new org.apache.avro.ipc.MD5(); in.readFixed(this.clientHash.bytes(), 0, 16); this.serverHash = new org.apache.avro.ipc.MD5(); in.readFixed(this.serverHash.bytes(), 0, 16); case 0: if (this.clientHash == null) { this.clientHash = new org.apache.avro.ipc.MD5(); in.readFixed(this.clientHash.bytes(), 0, 16); break; this.serverHash = new org.apache.avro.ipc.MD5(); in.readFixed(this.serverHash.bytes(), 0, 16); break;
if (localHash.equals(request.serverHash)) { response.match = remote == null ? HandshakeMatch.NONE : HandshakeMatch.BOTH;
private void writeHandshake(Encoder out) throws IOException { if (getTransceiver().isConnected()) return; MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } else { remote = REMOTE_PROTOCOLS.get(remoteHash); } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = local.toString(); RPCContext context = new RPCContext(); context.setHandshakeRequest(handshake); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }
if (localHash.equals(request.serverHash)) { response.match = remote == null ? HandshakeMatch.NONE : HandshakeMatch.BOTH;
} else { if (this.serverHash == null) { this.serverHash = new org.apache.avro.ipc.MD5(); in.readFixed(this.serverHash.bytes(), 0, 16); } else { if (this.serverHash == null) { this.serverHash = new org.apache.avro.ipc.MD5(); in.readFixed(this.serverHash.bytes(), 0, 16);
if (localHash.equals(request.serverHash)) { response.match = remote == null ? HandshakeMatch.NONE : HandshakeMatch.BOTH;
private void writeHandshake(Encoder out) throws IOException { MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); remote = REMOTE_PROTOCOLS.get(remoteHash); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = new Utf8(local.toString()); RPCContext context = new RPCContext(); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }
private void writeHandshake(Encoder out) throws IOException { if (getTransceiver().isConnected()) return; MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); remote = REMOTE_PROTOCOLS.get(remoteHash); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = new Utf8(local.toString()); RPCContext context = new RPCContext(); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }
private void writeHandshake(Encoder out) throws IOException { if (getTransceiver().isConnected()) return; MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } else { remote = REMOTE_PROTOCOLS.get(remoteHash); } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = local.toString(); RPCContext context = new RPCContext(); context.setHandshakeRequest(handshake); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }