// Path: src/main/java/net/java/otr4j/io/messages/DHKeyMessage.java
// public class DHKeyMessage extends AbstractEncodedMessage {
// 
// 	public DHPublicKey dhPublicKey;
// 
// 	public DHKeyMessage(int protocolVersion, DHPublicKey dhPublicKey) {
// 		super(MESSAGE_DHKEY, protocolVersion);
// 		this.dhPublicKey = dhPublicKey;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = super.hashCode();
// 		// TODO: Needs work.
// 		result = prime * result
// 				+ ((dhPublicKey == null) ? 0 : dhPublicKey.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (!super.equals(obj))
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		DHKeyMessage other = (DHKeyMessage) obj;
// 		if (dhPublicKey == null) {
// 			if (other.dhPublicKey != null)
// 				return false;
// 		} else if (dhPublicKey.getY().compareTo(other.dhPublicKey.getY()) != 0)
// 			return false;
// 		return true;
// 	}
// }
// 
// Path: src/main/java/net/java/otr4j/io/messages/RevealSignatureMessage.java
// public class RevealSignatureMessage extends SignatureMessage {
// 
// 	public byte[] revealedKey;
// 
// 	public RevealSignatureMessage(int protocolVersion, byte[] xEncrypted,
// 			byte[] xEncryptedMAC, byte[] revealedKey)
// 	{
// 		super(MESSAGE_REVEALSIG, protocolVersion, xEncrypted, xEncryptedMAC);
// 
// 		this.revealedKey = revealedKey;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = super.hashCode();
// 		result = prime * result + Arrays.hashCode(revealedKey);
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (!super.equals(obj))
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		RevealSignatureMessage other = (RevealSignatureMessage) obj;
// 		if (!Arrays.equals(revealedKey, other.revealedKey))
// 			return false;
// 		return true;
// 	}
// }


import static org.junit.Assert.assertArrayEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
import java.security.KeyPair;
import javax.crypto.interfaces.DHPublicKey;
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
import net.java.otr4j.io.messages.DHKeyMessage;
import net.java.otr4j.io.messages.RevealSignatureMessage;

		ByteArrayInputStream bin = new ByteArrayInputStream(converted);
		OtrInputStream ois = new OtrInputStream(bin);
		DHPublicKey result = ois.readDHPublicKey();

		assertEquals(0, source.getY().compareTo(result.getY()));
	}

	public void testIODHKeyMessage() throws Exception {
		KeyPair pair = new OtrCryptoEngineImpl().generateDHKeyPair();

		DHKeyMessage source = new DHKeyMessage(0, (DHPublicKey) pair
				.getPublic());

		String base64 = SerializationUtils.toString(source);
		DHKeyMessage result = (DHKeyMessage) SerializationUtils
				.toMessage(base64);

		assertEquals(source, result);
	}

	public void testIORevealSignature() throws Exception {
		int protocolVersion = 1;
		byte[] xEncrypted = new byte[] { 1, 2, 3, 4 };
		byte[] xEncryptedMAC = new byte[SerializationConstants.TYPE_LEN_MAC];
		for (int i = 0; i < xEncryptedMAC.length; i++)
			xEncryptedMAC[i] = (byte) i;

		byte[] revealedKey = new byte[] { 1, 2, 3, 4 };

// Path: src/main/java/net/java/otr4j/io/messages/DHKeyMessage.java
// public class DHKeyMessage extends AbstractEncodedMessage {
// 
// 	public DHPublicKey dhPublicKey;
// 
// 	public DHKeyMessage(int protocolVersion, DHPublicKey dhPublicKey) {
// 		super(MESSAGE_DHKEY, protocolVersion);
// 		this.dhPublicKey = dhPublicKey;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = super.hashCode();
// 		// TODO: Needs work.
// 		result = prime * result
// 				+ ((dhPublicKey == null) ? 0 : dhPublicKey.hashCode());
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (!super.equals(obj))
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		DHKeyMessage other = (DHKeyMessage) obj;
// 		if (dhPublicKey == null) {
// 			if (other.dhPublicKey != null)
// 				return false;
// 		} else if (dhPublicKey.getY().compareTo(other.dhPublicKey.getY()) != 0)
// 			return false;
// 		return true;
// 	}
// }
// 
// Path: src/main/java/net/java/otr4j/io/messages/RevealSignatureMessage.java
// public class RevealSignatureMessage extends SignatureMessage {
// 
// 	public byte[] revealedKey;
// 
// 	public RevealSignatureMessage(int protocolVersion, byte[] xEncrypted,
// 			byte[] xEncryptedMAC, byte[] revealedKey)
// 	{
// 		super(MESSAGE_REVEALSIG, protocolVersion, xEncrypted, xEncryptedMAC);
// 
// 		this.revealedKey = revealedKey;
// 	}
// 
// 	@Override
// 	public int hashCode() {
// 		final int prime = 31;
// 		int result = super.hashCode();
// 		result = prime * result + Arrays.hashCode(revealedKey);
// 		return result;
// 	}
// 
// 	@Override
// 	public boolean equals(Object obj) {
// 		if (this == obj)
// 			return true;
// 		if (!super.equals(obj))
// 			return false;
// 		if (getClass() != obj.getClass())
// 			return false;
// 		RevealSignatureMessage other = (RevealSignatureMessage) obj;
// 		if (!Arrays.equals(revealedKey, other.revealedKey))
// 			return false;
// 		return true;
// 	}
// }


// Path: src/test/java/net/java/otr4j/io/IOTest.java
import static org.junit.Assert.assertArrayEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
import java.security.KeyPair;
import javax.crypto.interfaces.DHPublicKey;
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
import net.java.otr4j.io.messages.DHKeyMessage;
import net.java.otr4j.io.messages.RevealSignatureMessage;


		ByteArrayInputStream bin = new ByteArrayInputStream(converted);
		OtrInputStream ois = new OtrInputStream(bin);
		DHPublicKey result = ois.readDHPublicKey();

		assertEquals(0, source.getY().compareTo(result.getY()));
	}

	public void testIODHKeyMessage() throws Exception {
		KeyPair pair = new OtrCryptoEngineImpl().generateDHKeyPair();

		DHKeyMessage source = new DHKeyMessage(0, (DHPublicKey) pair
				.getPublic());

		String base64 = SerializationUtils.toString(source);
		DHKeyMessage result = (DHKeyMessage) SerializationUtils
				.toMessage(base64);

		assertEquals(source, result);
	}

	public void testIORevealSignature() throws Exception {
		int protocolVersion = 1;
		byte[] xEncrypted = new byte[] { 1, 2, 3, 4 };
		byte[] xEncryptedMAC = new byte[SerializationConstants.TYPE_LEN_MAC];
		for (int i = 0; i < xEncryptedMAC.length; i++)
			xEncryptedMAC[i] = (byte) i;

		byte[] revealedKey = new byte[] { 1, 2, 3, 4 };

		RevealSignatureMessage source = new RevealSignatureMessage(