This presentation deals with a complex approach to application testing in back end and front end parts, tests writing and common mistakes. It also includes a short overview of libraries and frameworks for creation of tests, as well as practical examples of code.
Presentation by Pavlo Iuriichuk, Lead Software Engineer, GlobalLogic, Kyiv), delivered at an open techtalk on December 11, 2014.
More details - http://globallogic.com.ua/report-web-testing-techtalk-2014
Unit Testing Express and Koa Middleware in ES2015Morris Singer
Even for JavaScript software developers well-versed in Agile practices, using test-driven development in the development of Node.js-based webservers can be challenging. In this presentation, I identify solutions to some of the most significant challenges to using TDD to build middleware stacks, with a focus on Express and Koa.
Salesforce provides an interface for testing callouts named HttpCalloutMock used to cover remote callouts. While adequate for simple callouts, in the real world you often need something more flexible, as in the case of multiple and varying responses from the same or varying endpoints. More precise testing and coverage can be obtained by extending the standard interface. Join us as we demonstrate a solution to use to enable the flexibility required for complex integration and synchronization apps.
Advanced Jasmine - Front-End JavaScript Unit TestingLars Thorup
Code: https://github.com/larsthorup/jasmine-demo-advanced
Video: https://www.youtube.com/watch?v=g4eQplHxU18
Audio: https://www.youtube.com/watch?v=8FUwc3gZDMw
Unit testing front-end JavaScript presents its own unique set of challenges. In this session we will look at number of different techniques to tackle these challenges and make our JavaScript unit tests fast and robust. We plan to cover the following subjects:
* Mocking and spy techniques to avoid dependencies on
- Functions, methods and constructor functions
- Time (new Date())
- Timers (setTimeout, setInterval)
- Ajax requests
- The DOM
- Events
* Expressive matchers
- Jasmine-jQuery
* Structuring tests for reuse and readability
* Testing browser-specific behaviour
Even for JavaScript software developers well-versed in Agile practices, using test-driven development in Node.js and Express can be challenging. In this presentation, I identify solutions to some of the most significant challenges to using TDD with Express, including mocking data in MongoDB / Mongoose, using promises to control asynchronous testing in Mocha with Chai, and separating concerns to write robust and enduring test suites.
This presentation deals with a complex approach to application testing in back end and front end parts, tests writing and common mistakes. It also includes a short overview of libraries and frameworks for creation of tests, as well as practical examples of code.
Presentation by Pavlo Iuriichuk, Lead Software Engineer, GlobalLogic, Kyiv), delivered at an open techtalk on December 11, 2014.
More details - http://globallogic.com.ua/report-web-testing-techtalk-2014
Unit Testing Express and Koa Middleware in ES2015Morris Singer
Even for JavaScript software developers well-versed in Agile practices, using test-driven development in the development of Node.js-based webservers can be challenging. In this presentation, I identify solutions to some of the most significant challenges to using TDD to build middleware stacks, with a focus on Express and Koa.
Salesforce provides an interface for testing callouts named HttpCalloutMock used to cover remote callouts. While adequate for simple callouts, in the real world you often need something more flexible, as in the case of multiple and varying responses from the same or varying endpoints. More precise testing and coverage can be obtained by extending the standard interface. Join us as we demonstrate a solution to use to enable the flexibility required for complex integration and synchronization apps.
Advanced Jasmine - Front-End JavaScript Unit TestingLars Thorup
Code: https://github.com/larsthorup/jasmine-demo-advanced
Video: https://www.youtube.com/watch?v=g4eQplHxU18
Audio: https://www.youtube.com/watch?v=8FUwc3gZDMw
Unit testing front-end JavaScript presents its own unique set of challenges. In this session we will look at number of different techniques to tackle these challenges and make our JavaScript unit tests fast and robust. We plan to cover the following subjects:
* Mocking and spy techniques to avoid dependencies on
- Functions, methods and constructor functions
- Time (new Date())
- Timers (setTimeout, setInterval)
- Ajax requests
- The DOM
- Events
* Expressive matchers
- Jasmine-jQuery
* Structuring tests for reuse and readability
* Testing browser-specific behaviour
Even for JavaScript software developers well-versed in Agile practices, using test-driven development in Node.js and Express can be challenging. In this presentation, I identify solutions to some of the most significant challenges to using TDD with Express, including mocking data in MongoDB / Mongoose, using promises to control asynchronous testing in Mocha with Chai, and separating concerns to write robust and enduring test suites.
I need you to modify and change the loop in this code without changing.docxhendriciraida
I need you to modify and change the loop in this code without changing the output
import java.io.*;
import java.net.*;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class TCPServer {
/**
* args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int port = 5555;
try (ServerSocket serverSocket = new ServerSocket(port)) {
System.out.println("Server is listening on port " + port);
while (true) {
System.out.println("waiting for a client to connect.");
Socket socket = serverSocket.accept();
System.out.println("New client connected");
DataInputStream dis = new DataInputStream(socket.getInputStream());
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
int option;
String text;
do {
System.out.println("Waiting for mode.");
option=dis.readInt();
switch(option)
{
case 1:
System.out.println("open mode activated.");
dos.writeUTF("open mode activated.");
do
{
text=dis.readUTF();
System.out.println("client sent: " + text);
dos.writeUTF(text);
}while(!text.equals("exit"));
break;
case 2:
System.out.println("secure mode activated.");
dos.writeUTF("secure mode activated.");
String keyString="1234567890123456";
String ivString="6543210987654321";
IvParameterSpec iv=new IvParameterSpec(ivString.getBytes("UTF-8"));
SecretKeySpec key=new SecretKeySpec(keyString.getBytes("UTF-8"),"AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, key, iv);
String plainString="";
do
{
text=dis.readUTF();
System.out.println("client sent: " + text);
byte[] plainText = cipher.doFinal(Base64.getDecoder().decode(text));
plainString=new String(plainText);
System.out.println("plain text is: " + plainString);
dos.writeUTF(text);
}while(!plainString.equals("exit"));
break;
case 3:
socket.close();
System.out.println("client has disconnected");
break;
}
} while (option !=3);
}
} catch (Exception ex) {
System.out.println("Server exception: " + ex.getMessage());
ex.printStackTrace();
}
}
}
.
Write a java program to create a program that outputs to the command l.docxlez31palka
Write a java program to create a program that outputs to the command line ping then pong, they must alternate between the 2. Contribute through comments or code
Solution
// SimpleServer.java: A simple server program.
import java.net.*;
import java.io.*;
public class SimpleServer {
public static void main(String args[]) throws IOException {
// Register service on port 1254
ServerSocket server = new ServerSocket(Protocol.TCP,1254);
Socket client=server.accept(null); // Wait and accept a connection
// Get a communication stream associated with the socket
String msg= new BufferedReader(new InputStreamReader(client.getInputStream())).readLine();
System.out.println(\"Got client message:\"+msg);
if(msg==\"PING\")
{
client.getOutputStream().write(\"PONG\ \".getBytes());
}
Client.close();
}
}
// SimpleClient.java: A simple client program.
import java.net.*;
import java.io.*;
public class SimpleClient {
public static void main(String args[]) throws IOException {
// Open your connection to a server, at port 1254
Socket client = new Socket(Protocol.TCP,“localhostâ€,1254);
client.getOutputStream().write(\"PING\ \".getBytes());
String response = new BufferedReader(new InputStreamReader(client.getInputStream())).readLine();
System.out.println( \"got server message: \" + response);
// When done, just close the connection and exit
client.close();
}
}
now compile individual files
and run
both
.
Hi, I need some one to help me with Design a client-server Chat so.pdffashiongallery1
Given the statement:
For every integer n > 2, n^2 – 6n + 1 > 0.
Is the text below a correct proof of the statement? (YES or NO? Explains your choice.)
Proof: By induction
Let S[n] be the statement that n^2 – 6n + 1 > 0
We show that if S[k] is true for some integer k > 2 then S[k + 1] is also true.
Suppose that k^2 – 6k + 1 > 0 (Induction Hypothesis)
Then (k + 1)^2 – 6(k + 1) + 1 = k^2 + 2k + 1 – 6k – 6 + 1 = (k^2 – 6k + 1) + (2k – 5)
Both bracketed expressions are positive: the first by the Induction Hypothesis, and the second
because k > 2. So S[k + 1] is true.
By PMI, S[n] is true for all n > 2.
Solution
There is nothing wrong in your proof.
BUT given statement is for every integer n > 2, n^2 - 6n +1 > 0
This is False.
Reason: for n = 3
3^2 - 6*3 + 1 = -8
-8 is not greater than zero.
So Given statement is wrong.
It would have been true if the statement is
for every integer n > 5, n^2 - 6n + 1 > 0
Let me know in the comments, if you have any doubt..
I need an explaining for each step in this code and the reason of it-.docxhendriciraida
I need an explaining for each step in this code and the reason of it.
import java.io.*;
import java.net.*;
import java.util.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
public class TCPServer {
/**
* args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int port = 6000;
try (ServerSocket serverSocket = new ServerSocket(port)) {
System.out.println("Server is listening on port " + port);
while (true) {
System.out.println("waiting for a client to connect.");
Socket socket = serverSocket.accept();
System.out.println("New client connected");
DataInputStream dis = new DataInputStream(socket.getInputStream());
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
int option;
String text;
System.out.println("Waiting for mode.");
option=dis.readInt();
switch(option)
{
case 1:
System.out.println("open mode activated.");
dos.writeUTF("open mode activated.");
do
{
text=dis.readUTF();
System.out.println("client sent: " + text);
dos.writeUTF(text);
}while(!text.equals("exit"));
break;
case 2:
System.out.println("secure mode activated.");
dos.writeUTF("secure mode activated.");
String keyString="1234567890123456";
String ivString="6543210987654321";
IvParameterSpec iv=new IvParameterSpec(ivString.getBytes("UTF-8"));
SecretKeySpec key=new SecretKeySpec(keyString.getBytes("UTF-8"),"AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, key, iv);
String plainString="";
do
{
text=dis.readUTF();
System.out.println("client sent: " + text);
byte[] plainText = cipher.doFinal(Base64.getDecoder().decode(text));
plainString=new String(plainText);
System.out.println("plain text is: " + plainString);
dos.writeUTF(text);
}while(!plainString.equals("exit"));
break;
case 3:
socket.close();
System.out.println("client has disconnected");
break;
}
}
} catch (Exception ex) {
/*System.out.println("Server exception: " + ex.getMessage());
ex.printStackTrace();
*/
System.out.println("port : " + port);
}
}
}
.
Note Use Java Write a web server that is capable of processing only.pdffatoryoutlets
Many mathematical problems require the addition, subtraction, and multiplication of two
matrices. Write an ADT Matrix. You may use the following class definition. const int
MAX_ROWS = 10; const int MAX_COLS = 10; class MatrixType { public: MatrixType(); void
MakeEmpty(); void SetSize(int rowsSize, int colSize); void StoreItem(int item, int row, int col);
void Add(MatrixType otherOperand, MatrixType& result); void Sub(MatrixType otherOperand,
MatrixType& result); void Mult(MatrixType otherOperand, MatrixType& result); void
Print(ofstream& outfile); bool AddSubCompatible(MatrixType otherOperand); bool
MultCompatible(MatrixType otherOperand); private: int values[MAX_ROWS][MAX_COLS];
int numRows; int numCols; }; Before you start looking at how to implement this class, you must
determine and document the appropriate preconditions and postconditions for each operation.
Note that the class provides the member functions to allow the client to determine if the binary
matrix operations are possible. Before this class can become a permanent part of your program
library, it must be thoroughly tested. Write a menu driven testing program to test your
MatrixType. Test Driver The test driver should handle the following options. (See processing
notes for definition of ). GetNewMatrix Number of rows and number of columns are on the next
line. Values for each row and column AddMatrices Add first and second, leaving the result in the
third SubMatrices Subtract second from first, leaving the result in the third MultiplyMatrices
Multiply first and second, leaving the result in the third PrintMatrix Print the matrix one row per
line on DataOut Quit Processing Notes 1. is a number between 0 and 9. This value is used as an
index into an array of MatrixType. 2. The main function must include a Switch statement where
the case expression is a user-defined enumeration type. This means that the command is
recognized and its enumeration equivalent is sent back to be used in the case statement. 3. The
driver must ensure the preconditions of the member functions of MatrixType. Throw an
exception if an error occurs and continue processing.
Solution
#include
#include
using namespace std;
struct matrixType{
int matDimension;
int matValues[10][10];
};
class MatrixADT{
private:
matrixType resultMatrix;
public:
void intializeResultMatrix(int);
matrixType add(matrixType, matrixType);
matrixType subtract(matrixType,matrixType);
matrixType multiply(matrixType,matrixType);
void printResult();
};
matrixType MatrixADT::add(matrixType M1, matrixType M2){
}
matrixType MatrixADT::subtract(matrixType M1, matrixType M2){
}
matrixType MatrixADT::multiply(matrixType M1, matrixType M2){
}
void MatrixADT::intializeResultMatrix(int dim){
}
int main(){
MatrixADT maX;
matrixType M1, M2;
char op;
int dim;
maX.printResult();
}
void MatrixADT::printResult(){
int i,j;
for (i=0;i
for (j=0; j
cout<.
- Practical exercises on the use of the threads with TCP
- References
YouTube link :
https://www.youtube.com/playlist?list=PLtDIUAtyP4lhV7CsYfLuIx26UeG4J-ujZ
GitHub :
https://github.com/Ghadeerof
Please look at the attach See.doc. I am getting this error all th.docxrandymartin91030
Please look at the attach: See.doc. I am getting this error all the time
4
Lecture 1
The Socket API
For Chapter 4 of your second textbook
You need to read your book and practice the exercises. This is just an extra note for the chapter.
Read this lecture after you have read chapter 4 of your second textbook.
Note: I included extra file for those students who do not have SSH on their Windows.
Introduction
For the first part of the semester we study distributed programming. The programs are in Java. You can either use windows (XP, Vista, 7), and/or Linux. I assume you have a good knowledge in Java. However if you need tutorial in this language I can post or email my tutorial. But this tutorial is rather sizeable and may take a lot of your time. We use eclipse. I have a small tutorial about installing Java, eclipse, a couple of simple java programs to help you to trace a Java program using the debugging facilities of eclipse.
As always I try to clarify the subject by small programs rather than the big programs in the book to make it easier to follow.
Note: A good website on sockets is: http://docs.oracle.com/javase/tutorial/networking/TOC.html
4.1 Background
Through this part we like to have access to 2-3 computers. Let us assume a client program would like to request implementation of a task via a number server programs. I suggest having one server program in your Windows operating system and one in your account in our school server. Below are a couple of simple examples. I explain the APIs later. Just run those to make sure things are under control.
Example 1: In the following program the client asks a server to add numbers 5 and 7.
The server program:
import java.io.*;
import java.net.*;
publicclass MyServer {
publicstaticvoid main(String[] args) throws IOException {
ServerSocket serverSocket = null;
try {//Keep this number. For the pace server this is the number we must use.
serverSocket = new ServerSocket(16790);
Socket clientSocket = null;
clientSocket = serverSocket.accept();
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
out.println("5 + 7 is: 12");
out.close();
clientSocket.close();
serverSocket.close();
} catch (IOException e) {
System.out.println("Error: " + e);
System.exit(0);
}
}
}
The client program:
import java.io.*;
import java.net.*;
publicclass MyClient {
publicstaticvoid main(String[] args) throws IOException {
Socket clientSocket = null;
BufferedReader in = null;
int ip;
try {//Keep this number. For the pace server this is the number we must use.
ip = 16790;
InetAddress host = InetAddress.getByName("localhost");//("vulcan.seidenberg.pace.edu");
clientSocket = new Socket(host, ip);
in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
String s = in.readLine();
while(s != null){
System.out.println(s);
s = in.readLine();
}
i.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
This is a presentation by Dada Robert in a Your Skill Boost masterclass organised by the Excellence Foundation for South Sudan (EFSS) on Saturday, the 25th and Sunday, the 26th of May 2024.
He discussed the concept of quality improvement, emphasizing its applicability to various aspects of life, including personal, project, and program improvements. He defined quality as doing the right thing at the right time in the right way to achieve the best possible results and discussed the concept of the "gap" between what we know and what we do, and how this gap represents the areas we need to improve. He explained the scientific approach to quality improvement, which involves systematic performance analysis, testing and learning, and implementing change ideas. He also highlighted the importance of client focus and a team approach to quality improvement.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
The French Revolution Class 9 Study Material pdf free download
Laporan tugas network programming
1. LAPORAN TUGAS NETWORK PROGRAMMING
NAMA : RAHMAT HAMDANI
NIM: 201913002
Keterangan : Permasalahannyaterletakdisaatrun,chatyang dikirimolehclienttidakbisa
diketahui olehclientlain.Programtidakmendukunguntukmelakukanbroadcastantar client.
2. Server hanya bisa menerima satu client dan tidak menerima lebih dari satu client. Indikasi
permasalahannya terletak pada kekuatan jaringan yang tidak mendukung.
Source code
package syarifchatting;
import java.awt.Color;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.Normalizer.Form;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JColorChooser;
import javax.swing.JOptionPane;
/**
* @author MhdSyarif
* Monday, 13 January 2014, 20 : 52 : 20 WIB
* Tugas III Matakulia Java2SE
* Mhd. Syarif | 49013075
* TKJMD - STEI - ITB
*/
3. public class Server extends javax.swing.JFrame implements Runnable{
int port=8080;
Socket client;
ServerSocket server;
BufferedReader Server_Reader, Client_Reader;
BufferedWriter Server_Writer, Client_Writer;
/**
* Creates new form Server
*/
public Server() {
super("www.mhdsyarif.com"); //SetTitle
initComponents();
//Menampilkan hasil ditengah window
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
java.awt.Dimension dialogSize = getSize();
setLocation((screenSize.width-
dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
getBackgroundColor();
}
//Pilihan ComboBox
private void getComboBox(){
if(ComboBox.getSelectedItem().equals("Server")){
ButtonOn.setText("On");
Username.setText("Server");
}else{
ButtonOn.setText("Connect");
Username.setText("Client");
}
}
//Koneksi client ke server
private void getClientConnec(){
try {
String ip = JOptionPane.showInputDialog(" Input IP Address");
client = new Socket(ip, port);
ComboBox.setEnabled(false);
ButtonOn.setText("Disconnect");
Server_Reader = new BufferedReader(new
InputStreamReader(client.getInputStream()));
Server_Writer = new BufferedWriter (new
OutputStreamWriter(client.getOutputStream()));
} catch (UnknownHostException ex) {
System.out.println("Accept Failed");
System.exit(-1);
} catch (IOException ex) {
Logger.getLogger(Form.class.getName()).log(Level.SEVERE, null,
ex);
}
}
private void getReadConnec(){
// try {
// try {
// try {
// server = new ServerSocket(port);
// this.setTitle("Please Wait");
// } catch (IOException ex) {
4. // System.out.println("Could not listen");
// System.exit(-1);
// }
// client = server.accept();
// this.setTitle("Connected" + client.getInetAddress());
// } catch (IOException ex) {
// System.out.println("Accept Failed");
// System.exit(-1);
// }
// Server_Reader = new BufferedReader(new
InputStreamReader(client.getInputStream()));
// Server_Writer = new BufferedWriter(new
OutputStreamWriter(client.getOutputStream()));
// } catch (IOException ex) {
// System.out.println("Read Failed");
// System.exit(-1);
// }
final int PORT = 8080;
try {
server = new ServerSocket(PORT);
} catch (IOException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE,
null, ex);
}
System.out.println("Server started...");
System.out.println("Wating for clients...");
while (true) {
try {
client = server.accept();
} catch (IOException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE,
null, ex);
}
Thread t = new Thread() {
public void run() {
try {
Server_Reader = new BufferedReader(new
InputStreamReader(client.getInputStream()));
} catch (IOException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
}
try {
Server_Writer = new BufferedWriter (new
OutputStreamWriter(client.getOutputStream()));
} catch (IOException ex) {
Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);
}
try (
PrintWriter out = new
PrintWriter(client.getOutputStream(), true);
Scanner in = new Scanner(client.getInputStream());
) {
5. while (in.hasNextLine()) {
String input = in.nextLine();
if (input.equalsIgnoreCase("exit")) {
break;
}
System.out.println("Received radius from
client: " + input);
// double radius = Double.valueOf(input);
// double area = Math.PI* radius *radius ;
// out.println(area);
}
} catch (IOException e) { }
}
};
t.start();
}
}
private void getDisconnectedClient(){
try {
client.close();
Server_Reader.close();
Server_Writer.close();
ComboBox.setEnabled(true);
ButtonOn.setText("Connect");
} catch (IOException ex) {
Logger.getLogger(Form.class.getName()).log(Level.SEVERE, null,
ex);
}
}
private void getDisconnectedServer(){
try {
Server_Reader.close();
Server_Writer.close();
ButtonOn.setText("On");
this.setTitle("Disconected");
} catch (IOException ex) {
Logger.getLogger(Form.class.getName()).log(Level.SEVERE, null,
ex);
}
}
private void getButtonOn(){
if(ButtonOn.getText().equals("Connect"))
{
ButtonOn.setText("DIsconnect");
getClientConnec();
Thread thread1= new Thread(this);
Thread thread2= new Thread(this);
Thread thread3= new Thread(this);
Thread thread4= new Thread(this);
Thread thread5= new Thread(this);
Thread thread6= new Thread(this);
Thread thread7= new Thread(this);
Thread thread8= new Thread(this);
Thread thread9= new Thread(this);
Thread thread10= new Thread(this);
thread1.start();
thread2.start();
6. thread3.start();
thread4.start();
thread5.start();
thread6.start();
thread7.start();
thread8.start();
thread9.start();
thread10.start();
} else if(ComboBox.getSelectedItem().equals("Server")){
ButtonOn.setText("Off");
getReadConnec();
Thread thread1= new Thread(this);
Thread thread2= new Thread(this);
Thread thread3= new Thread(this);
Thread thread4= new Thread(this);
Thread thread5= new Thread(this);
Thread thread6= new Thread(this);
Thread thread7= new Thread(this);
Thread thread8= new Thread(this);
Thread thread9= new Thread(this);
Thread thread10= new Thread(this);
thread1.start();
thread2.start();
thread3.start();
thread4.start();
thread5.start();
thread6.start();
thread7.start();
thread8.start();
thread9.start();
thread10.start();
}else if(ButtonOn.getText().equals("Disconnect")){
getDisconnectedClient();
}else if(ButtonOn.getText().equals("Off")){
getDisconnectedServer();
}
}
private void getSend(){
try {
Server_Writer.write(Username.getText()+ ":
"+TextChat.getText());
Server_Writer.newLine();
Server_Writer.flush();
} catch (IOException ex) {
Logger.getLogger(Form.class.getName()).log(Level.SEVERE, null,
ex);
}
ListChat.add(Username.getText()+ ": " +TextChat.getText());
//jClient.setText(Username.getText());
TextChat.setText("");
}
//Background color
public void getBackgroundColor(){
Color c = JColorChooser.showDialog(null,"Background
Color",jPanel.getBackground());
jPanel.setBackground(c);
}
//Konfirmasi keluar
7. public void getExit(){
int confirm =JOptionPane.showConfirmDialog(this,"Are you sure will
exit this application ?","Exit
Application",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
if (confirm == JOptionPane.YES_OPTION){
System.exit(0);
}
}