diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java
index b636694..a20e37f 100644
--- a/src/org/ice4j/ice/Agent.java
+++ b/src/org/ice4j/ice/Agent.java
@@ -322,4 +322,30 @@ public class Agent
return mediaStreams.size();
}
}
+
+ /**
+ * Returns a String representation of this agent.
+ *
+ * @return a String representation of this agent.
+ */
+ @Override
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer("ICE Agent (stream-count=");
+
+ buff.append(getStreamCount()).append(" ice-pwd:").append(getPassword());
+ buff.append(getStreamCount()).append(" ice-ufrag:")
+ .append(getUserName());
+ buff.append("):\n");
+
+ List streams = getStreams();
+ for(IceMediaStream stream : streams)
+ {
+ buff.append(stream.toString()).append("\n");
+ }
+
+ return buff.toString();
+ }
+
+
}
diff --git a/src/org/ice4j/ice/Candidate.java b/src/org/ice4j/ice/Candidate.java
index d338822..530437b 100644
--- a/src/org/ice4j/ice/Candidate.java
+++ b/src/org/ice4j/ice/Candidate.java
@@ -141,14 +141,6 @@ public abstract class Candidate
this.candidateType = type;
}
- /**
- * Gets the DatagramSocket associated with this Candidate.
- *
- * @return the DatagramSocket associated with this
- * Candidate
- */
- public abstract DatagramSocket getSocket();
-
/**
* Returns the type of this candidate which should be an instance of the
* {@link CandidateType} enumeration.
diff --git a/src/org/ice4j/ice/Component.java b/src/org/ice4j/ice/Component.java
index 0cd99d1..8bbba33 100644
--- a/src/org/ice4j/ice/Component.java
+++ b/src/org/ice4j/ice/Component.java
@@ -108,13 +108,13 @@ public class Component
}
/**
- * Add a local candidate to this component. The method has package access
- * because local candidates can only be created and added by the candidate
- * harvesters registered with the agent.
+ * Add a local candidate to this component. The method should only be
+ * accessed and local candidates added by the candidate harvesters
+ * registered with the agent.
*
* @param candidate the candidate object to be added
*/
- protected void addLocalCandidate(Candidate candidate)
+ public void addLocalCandidate(Candidate candidate)
{
synchronized(localCandidates)
{
diff --git a/src/org/ice4j/ice/HostCandidate.java b/src/org/ice4j/ice/HostCandidate.java
index b83f924..67d20be 100644
--- a/src/org/ice4j/ice/HostCandidate.java
+++ b/src/org/ice4j/ice/HostCandidate.java
@@ -25,7 +25,7 @@ import org.ice4j.*;
*
* @author Emil Ivov
*/
-public class HostCandidate extends Candidate
+public class HostCandidate extends LocalCandidate
{
/**
@@ -59,7 +59,7 @@ public class HostCandidate extends Candidate
*
* @return the DatagramSocket associated with this
* Candidate
- * @see Candidate#getSocket()
+ * @see LocalCandidate#getSocket()
*/
public DatagramSocket getSocket()
{
diff --git a/src/org/ice4j/ice/IceMediaStream.java b/src/org/ice4j/ice/IceMediaStream.java
index c7e25e3..7df78c2 100644
--- a/src/org/ice4j/ice/IceMediaStream.java
+++ b/src/org/ice4j/ice/IceMediaStream.java
@@ -108,7 +108,20 @@ public class IceMediaStream
*/
public String toString()
{
- return "media stream:" + getName();
+ StringBuffer buff = new StringBuffer( "media stream:")
+ .append(getName());
+ buff.append(" (component count=").append(getComponentCount())
+ .append(")");
+
+ List components = getComponents();
+ for (Component cmp : components)
+ {
+ buff.append("Component ").append(cmp.getComponentID())
+ .append(" :\n");
+ buff.append(cmp);
+ }
+
+ return buff.toString();
}
/**
@@ -143,6 +156,21 @@ public class IceMediaStream
}
}
+ /**
+ * Returns the number of Components currently registered with this
+ * stream.
+ *
+ * @return the number of Components currently registered with this
+ * stream.
+ */
+ public int getComponentCount()
+ {
+ synchronized(components)
+ {
+ return components.size();
+ }
+ }
+
/**
* Returns the IDs of all Components currently registered with this
* stream.
diff --git a/src/org/ice4j/ice/RemoteCandidate.java b/src/org/ice4j/ice/RemoteCandidate.java
index 97c4713..74ee144 100644
--- a/src/org/ice4j/ice/RemoteCandidate.java
+++ b/src/org/ice4j/ice/RemoteCandidate.java
@@ -38,16 +38,4 @@ public class RemoteCandidate
{
super(transportAddress, parentComponent, type);
}
-
- /**
- * Always returns null since remote candidates do not have a
- * DatagramSocket associated with them.
- *
- * @return null
- */
- public DatagramSocket getSocket()
- {
- return null;
- }
-
}
diff --git a/src/org/ice4j/ice/ServerReflexiveCandidate.java b/src/org/ice4j/ice/ServerReflexiveCandidate.java
index 0509fd9..a3a1798 100644
--- a/src/org/ice4j/ice/ServerReflexiveCandidate.java
+++ b/src/org/ice4j/ice/ServerReflexiveCandidate.java
@@ -24,7 +24,7 @@ import org.ice4j.*;
*
* @author Emil Ivov
*/
-public class ServerReflexiveCandidate extends Candidate
+public class ServerReflexiveCandidate extends LocalCandidate
{
/**
@@ -55,10 +55,10 @@ public class ServerReflexiveCandidate extends Candidate
*
* @return the DatagramSocket associated with this
* Candidate
- * @see Candidate#getSocket()
+ * @see LocalCandidate#getSocket()
*/
public DatagramSocket getSocket()
{
- return getBase().getSocket();
+ return ((HostCandidate)getBase()).getSocket();
}
}