public static Peer createMapPeer(Map map) throws MessageException {
  if (!map.containsKey(PORT) || !map.containsKey(ADDRESS))   throw new MessageException("Invalid address map");
  int port=(int)(long)map.get(PORT);
  String address=(String)map.get(ADDRESS);
  String peerId=null;
  if (map.containsKey(PEER_ID))   peerId=(String)map.get(PEER_ID);
  return new Peer(peerId,new InetSocketAddress(address,port));
}

public static Peer createMapPeer ( Map map ) throws MessageException { if ( ! map . containsKey ( PORT ) || ! map . containsKey ( ADDRESS ) ) throw new MessageException ( "Invalid address map" ) ; int port = ( int ) ( long ) map . get ( PORT ) ; String address = ( String ) map . get ( ADDRESS ) ; String peerId = null ; if ( map . containsKey ( PEER_ID ) ) peerId = ( String ) map . get ( PEER_ID ) ; return new Peer ( peerId , new InetSocketAddress ( address , port ) ) ; }
create a peer from a map .
