if(((IpAddress)src_addr).getIpAddress() != null)
IpAddress tmp=(IpAddress)src_addr; if(tmp.getIpAddress() != null)
    public void writeTo(DataOutputStream out) throws IOException {        Map.Entry        entry;        byte leading=0;        if(dest_addr != null) {            leading+=DEST_SET;            if(dest_addr instanceof IpAddress)                leading+=IPADDR_DEST;        }        if(src_addr != null) {            leading+=SRC_SET;            if(src_addr instanceof IpAddress) {                leading+=IPADDR_SRC;                if(((IpAddress)src_addr).getIpAddress() == null) {                    leading+=SRC_HOST_NULL;                }            }        }        if(buf != null)            leading+=BUF_SET;        if(headers != null && headers.size() > 0)            leading+=HDRS_SET;        // 1. write the leading byte first        out.write(leading);        // 2. dest_addr        if(dest_addr != null) {            if(dest_addr instanceof IpAddress)                dest_addr.writeTo(out);            else                Util.writeAddress(dest_addr, out);        }        // 3. src_addr        if(src_addr != null) {            if(src_addr instanceof IpAddress) {                if(((IpAddress)src_addr).getIpAddress() != null)                    src_addr.writeTo(out);                else {                    out.writeInt(((IpAddress)src_addr).getPort());                }            }            else {                Util.writeAddress(src_addr, out);            }        }        // 4. buf        if(buf != null) {            out.writeInt(length);            out.write(buf, offset, length);        }        // 5. headers        if(headers != null && headers.size() > 0) {            out.writeInt(headers.size());            for(Iterator it=headers.entrySet().iterator(); it.hasNext();) {                entry=(Map.Entry)it.next();                out.writeUTF((String)entry.getKey());                writeHeader((Header)entry.getValue(), out);            }        }    }