### Question:
HServerAddress implements WritableComparable<HServerAddress> { public void readFields(DataInput in) throws IOException { String hostname = in.readUTF(); int port = in.readInt(); if (hostname != null && hostname.length() > 0) { this.address = getResolvedAddress(new InetSocketAddress(hostname, port)); checkBindAddressCanBeResolved(); createCachedToString(); } } HServerAddress();  HServerAddress(InetSocketAddress address);  HServerAddress(final String hostname, final int port);  HServerAddress(HServerAddress other); String getBindAddress(); int getPort(); String getHostname(); String getHostnameAndPort(); InetSocketAddress getInetSocketAddress(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); void readFields(DataInput in); void write(DataOutput out); int compareTo(HServerAddress o);  }### Answer:
@Test public void testReadFields() throws IOException { HServerAddress hsa1 = new HServerAddress("localhost", 1234); HServerAddress hsa2 = new HServerAddress("localhost", 1235); byte [] bytes = Writables.getBytes(hsa1); HServerAddress deserialized = (HServerAddress)Writables.getWritable(bytes, new HServerAddress()); assertEquals(hsa1, deserialized); bytes = Writables.getBytes(hsa2); deserialized = (HServerAddress)Writables.getWritable(bytes, new HServerAddress()); assertNotSame(hsa1, deserialized); }