More JDWP implementation cleanup.

tsu was confused by some logging that turns out to have been a mistake;
it basically meant "DDMS is not listening", which isn't generally interesting.
This patch relegates that to a VLOG(jdwp).

This patch also removes a bunch more of the adb/socket transport duplication.

Change-Id: I50114da96ec32c20e11ea5ea76d5beba29f30214
diff --git a/src/jdwp/jdwp_priv.h b/src/jdwp/jdwp_priv.h
index c03ad2a..1de4c41 100644
--- a/src/jdwp/jdwp_priv.h
+++ b/src/jdwp/jdwp_priv.h
@@ -43,10 +43,6 @@
 
 namespace JDWP {
 
-/*
- * Transport-specific network status.
- */
-struct JdwpNetState;
 struct JdwpState;
 
 /*
@@ -56,21 +52,16 @@
   bool (*startup)(JdwpState* state, const JdwpOptions* options);
   bool (*accept)(JdwpState* state);
   bool (*establish)(JdwpState* state, const JdwpOptions* options);
-  void (*close)(JdwpState* state);
   void (*shutdown)(JdwpState* state);
   void (*free)(JdwpState* state);
-  bool (*isConnected)(JdwpState* state);
-  bool (*awaitingHandshake)(JdwpState* state);
   bool (*processIncoming)(JdwpState* state);
-  bool (*sendRequest)(JdwpState* state, ExpandBuf* pReq);
-  bool (*sendBufferedRequest)(JdwpState* state, const iovec* iov, int iov_count);
 };
 
 const JdwpTransport* SocketTransport();
 const JdwpTransport* AndroidAdbTransport();
 
 /*
- * Base class for JdwpNetState
+ * Base class for the adb and socket JdwpNetState implementations.
  */
 class JdwpNetStateBase {
  public:
@@ -82,13 +73,27 @@
   size_t inputCount;
 
   JdwpNetStateBase();
+
   void ConsumeBytes(size_t byte_count);
+
+  bool IsConnected();
+
+  bool IsAwaitingHandshake();
+  void SetAwaitingHandshake(bool new_state);
+
+  bool HaveFullPacket();
+
+  void Close();
+
   ssize_t WritePacket(ExpandBuf* pReply);
   ssize_t WriteBufferedPacket(const iovec* iov, int iov_count);
 
  private:
   // Used to serialize writes to the socket.
   Mutex socket_lock_;
+
+  // Are we waiting for the JDWP handshake?
+  bool awaiting_handshake_;
 };
 
 }  // namespace JDWP