@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.search_hunter_result_layout); Log.d("MyMessagesActivity", "MyMessages Activity Called!!!!!!!!!!!!!!!!!"); btnBack = (Button) findViewById(R.id.btnSearchHunterResultBack); lvSearchResult = (ListView) findViewById(R.id.lvSearchHunterResult); ll = (LinearLayout) findViewById(R.id.llSearchHunterLinearLayout); ll.setVisibility(View.GONE); strUserName = getIntent().getStringExtra("UserName"); hunterList = new ArrayList<SearchHunterObject>(); strUserName = strUserName.replaceAll(" ", "%20"); if (CheckInternet.checkConn(getParent())) { pd = ProgressDialog.show(getParent(), "", "Loading....", true, true); RequestThread thread = new RequestThread(); thread.start(); } btnBack.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { GroupsGroup.group.back(); } }); lvSearchResult.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { SearchHunterObject selectedHunter = new SearchHunterObject(); selectedHunter = hunterList.get(position); recieverId = selectedHunter.getUserId(); Intent i = new Intent( MyMapSearchHunterResultToSendMessageActivity.this, MyMapSendMessageToHunter.class); i.putExtra("ReceiverId", recieverId); View v = MyMapGroup.group .getLocalActivityManager() .startActivity( "SendMessageReplyActivity", i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); MyMapGroup.group.replaceView(v); } }); }
public static void main(String args[]) { int n = 0; try { ServerSocket server = new ServerSocket(3029); // create a new socket to listen on System.out.println("Codejudge compilation server running ..."); while (true) { n++; // accept any incoming connection and process it on a new thread Socket s = server.accept(); RequestThread request = new RequestThread(s, n); request.start(); } } catch (IOException e) { e.printStackTrace(); } }
@SmallTest @Feature({"Cronet"}) public void testInitTwoEnginesInSequence() throws Exception { final CronetTestActivity activity = launchCronetTestAppAndSkipFactoryInit(); ConditionVariable runBlocker = new ConditionVariable(true); RequestThread thread1 = new RequestThread(activity, TEST_URL, runBlocker); RequestThread thread2 = new RequestThread(activity, URL_404, runBlocker); thread1.start(); thread1.join(); thread2.start(); thread2.join(); assertEquals(200, thread1.mListener.mResponseInfo.getHttpStatusCode()); assertEquals(404, thread2.mListener.mResponseInfo.getHttpStatusCode()); }
@SmallTest @Feature({"Cronet"}) public void testInitTwoEnginesSimultaneously() throws Exception { final CronetTestActivity activity = launchCronetTestAppAndSkipFactoryInit(); // Threads will block on runBlocker to ensure simultaneous execution. ConditionVariable runBlocker = new ConditionVariable(false); RequestThread thread1 = new RequestThread(activity, TEST_URL, runBlocker); RequestThread thread2 = new RequestThread(activity, URL_404, runBlocker); thread1.start(); thread2.start(); runBlocker.open(); thread1.join(); thread2.join(); assertEquals(200, thread1.mListener.mResponseInfo.getHttpStatusCode()); assertEquals(404, thread2.mListener.mResponseInfo.getHttpStatusCode()); }