public void setSocket(Socket socket) {
	    if (socket != null)
	    {
	      m_remoteAddress = socket.getInetAddress();
	      this.port = socket.getPort();
	      m_controlThread = new DebugControlConnectionThread(socket, this);
	      m_controlThread.start();
	      executeStartupCommands();
	      m_controlThread.sendMessage("getsettings");

	      m_controlThread.sendMessage("[out-network");
	      //m_controlThread.sendMessage("[out-network-true");
	      String networkTracePortStr = m_controlThread.getMessage();
	      int networkTracePort = Integer.parseInt(networkTracePortStr);
	      if (LOG.isDebugEnabled()) LOG.debug("Received network trace port [" + networkTracePort + "]");
	      
	      try
	      {
	        INetworkOutputConfig config = new INetworkOutputConfig()
	        {
		          @Override
		          public boolean isNetOutputEnabled()
		          {
		            return m_settingsData.netOutEnabled;
		          }

				@Override
				public boolean isGzipEnabled() {
					return m_settingsData.gzipEnabled;
				}
	        };
	        	        
	        m_networkTraceThread2 = new NetworkDataReceiverThread2(
	        							m_remoteAddress,
	        							networkTracePort, 
	        							config
	        							);
	        m_networkTraceThread2.start();
		      setConnectState(ConnectState.CONNECTED);
		      setConnectionStatusMsg(DefaultFactory.getFactory().getMessages().getConnected());
	        
	      } catch (IOException ex)
	      {
	    	  m_traceEvents.add(
	    			  	TraceFactory.createExceptionTraceEvent(
	    			  			org.headlessintrace.rcp.ClientStrings.TRACE_CREATION_ERROR, 
	    			  			ex, 
	    			  			m_remoteAddress, 
	    			  			networkTracePortStr));
	      }
	      
	    } else
	    {
	      setConnectState(ConnectState.DISCONNECTED_ERR);
	    }
	}
public void setSocket ( Socket socket ) { if ( socket != null ) { m_remoteAddress = socket . getInetAddress ( ) ; this . port = socket . getPort ( ) ; m_controlThread = new DebugControlConnectionThread ( socket , this ) ; m_controlThread . start ( ) ; executeStartupCommands ( ) ; m_controlThread . sendMessage ( "getsettings" ) ; m_controlThread . sendMessage ( "[out-network" ) ; String networkTracePortStr = m_controlThread . getMessage ( ) ; int networkTracePort = Integer . parseInt ( networkTracePortStr ) ; if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "Received network trace port [" + networkTracePort + "]" ) ; try { INetworkOutputConfig config = new INetworkOutputConfig ( ) { @ Override public boolean isNetOutputEnabled ( ) { return m_settingsData . netOutEnabled ; } @ Override public boolean isGzipEnabled ( ) { return m_settingsData . gzipEnabled ; } } ; m_networkTraceThread2 = new NetworkDataReceiverThread2 ( m_remoteAddress , networkTracePort , config ) ; m_networkTraceThread2 . start ( ) ; setConnectState ( ConnectState . CONNECTED ) ; setConnectionStatusMsg ( DefaultFactory . getFactory ( ) . getMessages ( ) . getConnected ( ) ) ; } catch ( IOException ex ) { m_traceEvents . add ( TraceFactory . createExceptionTraceEvent ( org . headlessintrace . rcp . ClientStrings . TRACE_CREATION_ERROR , ex , m_remoteAddress , networkTracePortStr ) ) ; } } else { setConnectState ( ConnectState . DISCONNECTED_ERR ) ; } }
Why do we have ConnectionPartOne and ConnectionPartTwo?
There is a hand off, and it happens right here.
Once ConnectionPartOne is finished with it's business,
it invokes this setSocket() method.